Skip to content

Instantly share code, notes, and snippets.

@jamie-ga
Created June 20, 2018 19:35
Show Gist options
  • Save jamie-ga/36543b8df139a2907bd801e90e09a2b1 to your computer and use it in GitHub Desktop.
Save jamie-ga/36543b8df139a2907bd801e90e09a2b1 to your computer and use it in GitHub Desktop.
Measuring / profiling postgres queries
SELECT query, calls, total_time, rows,
100.0 * shared_blks_hit / nullif(shared_blks_hit + shared_blks_read, 0) AS hit_percent
FROM pg_stat_statements ORDER BY total_time DESC LIMIT 100;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment