Skip to content

Instantly share code, notes, and snippets.

@mchristofides
Created January 26, 2023 18:23
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save mchristofides/3609be1ebd96a8bdba10446c35ca482c to your computer and use it in GitHub Desktop.
Top 50 queries by total blocks (buffers)
SELECT shared_blks_hit + shared_blks_read + shared_blks_dirtied + shared_blks_written + local_blks_hit + local_blks_read + local_blks_dirtied + local_blks_written + temp_blks_read + temp_blks_written as total_blocks
,(total_exec_time + total_plan_time)::int as total_time
,calls
,query
FROM pg_stat_statements
ORDER BY 1 DESC
LIMIT 50;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment