Skip to content

Instantly share code, notes, and snippets.

@mowings
Created January 26, 2023 15:09
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 mowings/7731b901765fd48424757b457d4f4257 to your computer and use it in GitHub Desktop.
Save mowings/7731b901765fd48424757b457d4f4257 to your computer and use it in GitHub Desktop.
Postgresql Cache hit ratio query
SELECT
sum(heap_blks_read) as heap_read,
sum(heap_blks_hit) as heap_hit,
sum(heap_blks_hit) / (sum(heap_blks_hit) + sum(heap_blks_read)) as cache_hit_ratio
FROM pg_statio_user_tables;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment