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:

Useful commands for observe running JVM process

$ jcmd List running processes $ jinfo  Get details of a process $ jps -lvm List running processes with params