Skip to content

Instantly share code, notes, and snippets.

@Charmatzis
Last active February 10, 2022 11:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Charmatzis/58956f8a8955ada1cf09459148269d1b to your computer and use it in GitHub Desktop.
Save Charmatzis/58956f8a8955ada1cf09459148269d1b to your computer and use it in GitHub Desktop.
Postgres - Most expensive queries
select round(( 100 * total_time / sum(total_time) over ())::numeric, 2) percent,
round(total_time::numeric, 2) as total,
calls,
round(mean_time::numeric, 2) as mean,
stddev_time,
query
from pg_stat_statements
order by total_time DESC
limit 10;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment