Tuesday, July 22, 2014

[PostgreSQL] See SQL queries (without restarting the server!)

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_statementreloading postgresql config

Credit: http://stackoverflow.com/a/8208376

No comments:

Config number of file descriptors on Linux

Check file descriptor limit for a process. Vary depending on owner of the process $ cat /proc/{process-id}/limits Check current number of...