PG_STAT_STATEMENTS ANALYZER · RUNS IN YOUR BROWSER · NEVER TOUCHES YOUR DATABASE

Which few queries are behind most of your Postgres load?

Run one read-only query against pg_stat_statements, paste the output, and get the query shapes ranked by total database time, the ones that look like N+1 loops, miss cache or spill to temp files, and what fixing the top few would be worth.

The text is read in this browser tab. No connection string, no credentials, no upload. Query text is what you paste, so glance at it before sharing the result.

1. Run this query

Read-only. Needs the pg_stat_statements extension (on by default on most managed Postgres). Postgres 13 or later; on 12 or earlier replace total_exec_time, mean_exec_time and stddev_exec_time with total_time, mean_time and stddev_time and drop wal_bytes.

In psql: \copy ( …query… ) TO 'statements.csv' WITH CSV HEADER. Any SQL client's "export as CSV" works.

2. Paste the result

Choose a file or paste CSV text, then click Analyze.

The rules, and what they leave out

Common questions

How do I find the slowest queries in Postgres?

Enable the pg_stat_statements extension, run the query on this page, and paste the CSV here. Queries are ranked by total execution time, which is what the database actually spent, not by how slow one call felt. A query that takes 2 ms but runs three million times costs more than one that takes two seconds and runs ten times.

What does pg_stat_statements measure?

For every normalised query shape it keeps the number of calls, total and mean execution time, rows, shared-buffer hits and reads, temp-file blocks and (on Postgres 13 and later) WAL bytes. The counters accumulate since the last reset, so a busy week and a quiet week can look the same. Reset them before a test if you want a clean window.

What is an N+1 suspect?

A single-row SELECT that runs far more often than anything else, returns about one row per call and takes only a millisecond or two. The tool cannot see your application, so it only says the pattern fits. If one page load or API request issues the lookup in a loop, batching the ids into one query with = ANY($1) or a join usually removes most of the calls.

Why are several entries merged into one?

pg_stat_statements stores a separate entry for each length of an IN list and each number of VALUES rows, so one query can be spread over dozens of entries. This tool merges entries that differ only in those lengths, comments or parameter numbering, and tells you how many it merged.

Does the tool connect to my database?

No. You run one read-only query and paste the result. The text is parsed in your browser and is not sent anywhere. Query text can contain table names and, if the application did not parameterise a value, literal data, so look at the paste before you share it with anyone.

What does it not see?

Query plans, indexes, lock waits, what the application does around a query, replicas, and how long the counters have been collecting. A flag is a reason to run EXPLAIN (ANALYZE, BUFFERS) on that query, not a diagnosis.

Is this database advice?

No. It applies fixed rules to the text you provide. You are responsible for checking its output and for any change you make to your database.