Skip to main content
View rawEdit

12. SLRU cache stats

Monitor the performance of PostgreSQL's internal SLRU caches. These caches manage transaction status (CLOG/pg_xact), subtransaction data (pg_subtrans), multixact members, and other internal structures.

When to use

  • Investigating IO contention or unusual wait events related to internal Postgres structures
  • Diagnosing performance issues with heavy use of subtransactions or multixact operations
  • Understanding SLRUReadPage or SLRUWritePage wait events seen in Wait event analysis

Key panels

  • SLRU hit ratio — cache hit rate for each SLRU cache type
  • SLRU read rate — pages read from disk per second
  • SLRU write rate — pages written to disk per second
  • SLRU cache types — breakdowns for CLOG, CommitTs, MultiXactMember, MultiXactOffset, Notify, Serial, Subtrans

What good looks like

  • Hit ratios are high (> 99% for most cache types)
  • Read and write rates are steady and consistent with the workload
  • No sustained spikes in SLRU disk reads

What to investigate

SignalNext step
Low CLOG hit ratioCLOG cache may be undersized for the workload; check pg_xact directory size
High Subtrans readsHeavy use of SAVEPOINT / subtransactions; consider reducing nesting depth
MultiXact activity spikesCheck for SELECT ... FOR KEY SHARE patterns or foreign key operations

Background

SLRU caches are fixed-size in-memory buffers that PostgreSQL uses to cache pages from on-disk structures. Unlike the main shared buffer pool, these caches cannot be resized without recompiling PostgreSQL (prior to version 16). In PostgreSQL 16+, some SLRU cache sizes are configurable.

  • G001 — memory-related settings