Erlang server for collecting stats in a PostgreSQL DB