“Show Full Processlist;” Equivalent Of MySQL For PostgreSQL

Want to help support this blog? Try out Oh Dear, the best all-in-one monitoring tool for your entire website, co-founded by me (the guy that wrote this blogpost). Start with a 10-day trial, no strings attached.

We offer uptime monitoring, SSL checks, broken links checking, performance & cronjob monitoring, branded status pages & so much more. Try us out today!

Profile image of Mattias Geniar

Mattias Geniar, February 23, 2010

Follow me on Twitter as @mattiasgeniar

MySQL has a very powerfull command through “show full processlist;", to see a list of currently running queries.

# mysql
# mysql > show full processlist;

PostgreSQL has a similar shell to MySQL, named psql. Here’s how it works. First, change to the postgres user.

# su postgres

Enter the PostgreSQL command shell.

# [postgres@srv]$ psql

And perform the query to see the current activity.

postgres=# select * from pg_stat_activity;

To quit the PostgreSQL shell, type "\q".

This requires you have PostgreSQL configured to enable logging.  Edit your PostgreSQL config file (usually at /usr/local/pgsql/data/postgresql.conf), and add the following line.

stats_command_string = true

And reload your PostgreSQL.

pg_ctl reload


Want to subscribe to the cron.weekly newsletter?

I write a weekly-ish newsletter on Linux, open source & webdevelopment called cron.weekly.

It features the latest news, guides & tutorials and new open source projects. You can sign up via email below.

No spam. Just some good, practical Linux & open source content.