Created
February 23, 2019 03:49
-
-
Save pyprism/d03e5168e9c7aa8d6adf25ac034e7aa0 to your computer and use it in GitHub Desktop.
A quick/dirty top 20 list of your slowest, or biggest, or hardest on the cpu queries. (Postgres)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT query | |
, calls | |
, total_time | |
, total_time / calls as time_per | |
, stddev_time | |
, rows | |
, rows / calls as rows_per | |
,100.0 * shared_blks_hit / nullif(shared_blks_hit + shared_blks_read, 0) AS hit_percent | |
FROM pg_stat_statements | |
WHERE query not similar to '%pg_%' | |
and calls > 500 | |
--ORDER BY calls | |
--ORDER BY total_time | |
order by time_per | |
--ORDER BY rows_per | |
DESC LIMIT 20; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment