PostgreSQLPerformance
Buffer cache hit ratio per database
Share of block reads served from shared buffers. OLTP databases usually sit above 99%; a drop suggests memory pressure or a new large scan.
Not yet verified. How scripts are tested
1SELECT datname,2 round(100.0 * blks_hit / NULLIF(blks_hit + blks_read, 0), 2) AS cache_hit_pct3FROM pg_stat_database4WHERE datname IS NOT NULL5ORDER BY cache_hit_pct;Paste it into your query tool.
More PostgreSQL scripts: Performance
- Top statements by total timeNeeds the pg_stat_statements extension. Column names are for PostgreSQL 13 and later; on 12 and earlier use total_time and mean_time.