Thursday, May 8, 2008

Postgres showprocesslist

Looking for something like showporcesslist for postgres, here is something I found.
Edit your postgres.conf
stats_start_collector = true

This must be set to true for the statistics collector to be launched at all.

stats_command_string = true

This enables monitoring of the current command being executed by any server process. The statistics collector subprocess need not be running to enable this feature.

After restarting postgres the following query will show currently running queries

psql -U postgres template1 -c "select * from pg_stat_activity"

only as user "postgres"

No comments: