Monitor Postgres pgbouncer

Pgbouncer is widely used with Postgres to provide connection pooling. Its an easy-to-use and easy-to-install piece of software. The general idea is to specify n number of connections allowed to pgbouncer and m connections allowed to Postgres itself where m is much less than n. A typical configuration is to set pgbouncer to transaction mode. This allows pgbouncer to multiplex the “real” connections to Postgres as transactions are committed or rolled back.

Read More

Using Postgres COPY with Elixir/Ecto

This post is about using Postgres COPY to retrieve data from the database into memory when using Elixir and Ecto. Let’s assume you want to read all the data from a table ‘accounts’ using Postgres COPY. Lets assume the table definition in Postgres is:

Read More

Elixir, Phoenix and Ecto fragment and SIMILAR TO

I had a part of a Phoenix web app where users wanted to save filters to the database and then be able to select and apply them to narrow a dataset. One of the key features that they wanted was the ability to wildcard search the fqdn column value (fqdn is fully qualified domain name in this case). Creating the filter and saving the data was fairly straightfoward but how could I use Ecto to apply “n” number of LIKE operators?

Read More

Elixir, Phoenix and Default Logging

If you are using the default Logger in your Elixir/Phoenix web app with no further configuration then your logs will rotate rather quickly. If you are using Distillery then, by default, your log files will be in var/log and they’ll be named like:

Read More