1. In postgresql.conf (probably under /etc/postgres/...), uncomment log_statement and set to 'all'
log_statement = 'all'2. To reload config, sending SIGHUP to postgres server by going to psql shell and execute:
select pg_reload_conf();There's an another way to send SIGHUP, please refer to the link below
3. Observe the queries at postgresql.log (probably under /var/log/...)
4. To disable, comment out log_statement and reload config again
log_statement, reloading postgresql config
Credit: http://stackoverflow.com/a/8208376