May 2019
Intermediate to advanced
600 pages
20h 46m
English
Run this query to look at the top ten highest workloads on your server side:
postgres=# SELECT calls, total_time, query FROM pg_stat_statements ORDER BY total_time DESC LIMIT 10;
The output is ordered by total_time, so it doesn't matter whether it was a single query or thousands of smaller queries.
There are many additional columns that are useful in tracking down further information about particular entries:
postgres=# \d pg_stat_statements View "public.pg_stat_statements" Column | Type | Modifiers ---------------------+------------------+----------- userid | oid | dbid | oid | queryid | bigint | query | text | calls | bigint | total_time | double precision | min_time | double precision | max_time | double precision ...
Read now
Unlock full access