May 052023

As my entry for PGSQL Phriday #008, I want to give some example queries you can use with pg_stat_statements as a starting point for different challenges!Reduce your workloadIf you’re looking to reduce load on your system as a whole, a great starting point is looking at your statements by total time, for example: select (total_exec_time + total_plan_time)::int as total_time, total_exec_time::int, total_plan_time::int, mean_exec_time::int, calls, query
from pg_stat_statements
order by total_time desc
limit 50; This will return the 50 queries that take the most time across all calls, meaning that fast queries that are executed a lot can rank ahead of slow queries that are executed infrequently. This is likely to be a good proxy for which queries are responsible for…

External feed Read More at the Source:


Sorry, the comment form is closed at this time.