Skip to content

Instantly share code, notes, and snippets.

@stuartmg
Created April 9, 2013 17:43
Show Gist options
  • Save stuartmg/5347758 to your computer and use it in GitHub Desktop.
Save stuartmg/5347758 to your computer and use it in GitHub Desktop.
Find out cache hit ratio in PostgreSQL. This should ideally be 99% or higher.
SELECT
sum(heap_blks_hit) / (sum(heap_blks_hit) + sum(heap_blks_read)) 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