View Active Postgres Queries

From Zanecorpwiki

Jump to: navigation, search

By default, this is off, but you can change this setting on a running DB. Just change/add the line in 'postgresql.conf':

stats_command_string = true

then:

pg_ctl -D ./data reload # where ./data is the path to the DB data dir

now from pgsql:

SELECT * FROM pg_stat_activity;

TODO: if we could get some info on how this effects performance.

Personal tools