DEV Community

Cover image for Debugging postgres: Showing recent queries
Stefan Ukena
Stefan Ukena

Posted on • Originally published at blog.ukena.de on

Debugging postgres: Showing recent queries

Postgres’ built-in pg_stat_activity-view shows the list of all open connections, including the current query from that connection in the query-column. What if that is not enough? How can you see not only the current query, but a list of recent queries? That is what the pg_stat_statements extension is for. Enabling the pg_stat_statements-extension Unlike pg_stat_activity, which is active by default, pg_stat_statements needs to be enabled on the postgres server. There are two steps:

Top comments (0)