Measure the cache hit ratio
Oracle
SELECT metric_name, ROUND(value, 2) AS pct
FROM v$sysmetric
WHERE metric_name = 'Buffer Cache Hit Ratio'
AND intsize_csec = (SELECT MAX(intsize_csec) FROM v$sysmetric);A low ratio is not always bad; interpret it in the context of the workload, not in isolation.
PostgreSQL
SELECT ROUND(sum(blks_hit) * 100.0 / NULLIF(sum(blks_hit) + sum(blks_read), 0), 2) AS cache_hit_pct
FROM pg_stat_database;99%+ is usually the target. If it is low, review shared_buffers and the OS cache.
MySQL
SELECT ROUND((1 - (
(SELECT variable_value FROM performance_schema.global_status WHERE variable_name='Innodb_buffer_pool_reads') /
(SELECT variable_value FROM performance_schema.global_status WHERE variable_name='Innodb_buffer_pool_read_requests')
)) * 100, 2) AS buffer_pool_hit_pct;reads are from disk, read_requests are total reads. If it is low, increase innodb_buffer_pool_size.
SQL Server
SELECT ROUND(
100.0 * (SELECT cntr_value FROM sys.dm_os_performance_counters WHERE counter_name='Buffer cache hit ratio')
/ NULLIF((SELECT cntr_value FROM sys.dm_os_performance_counters WHERE counter_name='Buffer cache hit ratio base'), 0), 2) AS pct;On modern SQL Server, Page Life Expectancy (PLE) is a more meaningful indicator of memory pressure.
MongoDB
var c = db.serverStatus().wiredTiger.cache;
({ configuredMB: +(c['maximum bytes configured']/1048576).toFixed(0),
inCacheMB: +(c['bytes currently in the cache']/1048576).toFixed(0),
readIntoCache: c['pages read into cache'],
evictedPages: c['unmodified pages evicted'] })High 'pages read into cache' and eviction indicate that the WiredTiger cache is too small.
Redis
INFO stats
# keyspace_hits / (keyspace_hits + keyspace_misses) = hit ratioA persistently low hit ratio indicates that TTL/eviction settings or the access pattern need review.