Looking for Buffer hit cache ratio in PostgreSQL?
SELECT datname,
blks_read,
blks_hit,
round((blks_hit::float / (blks_read+blks_hit+1) * 100)::numeric, 2) as cachehitratio
FROM pg_stat_database
WHERE datname !~ '^(template(0|1)|postgres)$'
ORDER BY cachehitratio desc;
That was an excerpt from a larger shell script that you could run to automate this collection. Here is that script...
http://www.nagiosexchange.org/cgi-bin/page.cgi?g=Detailed%2F2675.html;d=1
(Corrected an alias name from original version)


