SLRU cache is a PostgreSQL caching mechanism that stores and reuses small, sequentially accessed on-disk pages in shared memory. It is used for internal data such as transaction status and lock metadata, helping the database avoid repeated disk reads for frequently consulted system pages.
What SLRU Caching Does in PostgreSQL
SLRU, or simple least recently used, is a PostgreSQL internal cache for small, sequentially accessed on-disk pages. It keeps frequently reused system pages in shared memory so the database can avoid repeated disk I/O for metadata-heavy work such as transaction status checks and lock management.
Unlike a general-purpose buffer cache, SLRU is specialised for narrow internal structures that are touched often and predictably. That focus makes it efficient for a class of pages where locality matters more than broad data-set caching.
Why SLRU Exists
PostgreSQL uses SLRU to reduce latency in subsystems that would otherwise keep rereading the same small pages from disk. Those pages often represent state that must be consulted during normal database operation, so caching them avoids unnecessary storage round trips and reduces pressure on the underlying I/O path.
The design is also practical: these pages are not arbitrary user data, but compact internal records that benefit from a bounded, managed cache. SLRU helps the database spend memory where repeated lookups are most likely to pay off.
How the Cache Behaviour Works
SLRU is page-oriented and ordered around recent access. When PostgreSQL consults one of these internal page sets, the cache retains the pages that are most likely to be needed again soon, while older entries are displaced as newer activity arrives. The result is a targeted reuse layer for sequential access patterns rather than a universal storage cache.
Because the cache serves specific internal data structures, its behaviour is tightly coupled to database internals. That means its benefit depends on workload shape, concurrency, and how often those internal pages are revisited.
Operational Implications for PostgreSQL
SLRU is small in concept but important in effect: if the cache is under pressure, frequently accessed metadata pages may be fetched from disk more often, adding avoidable overhead to common database paths. For administrators, that makes SLRU part of the broader performance picture even though it is not usually tuned as directly as user-facing storage settings.
It also matters for observability. When transaction-related or lock-related activity becomes unusually expensive, SLRU is one of the internal mechanisms worth understanding because it sits between lightweight repeated metadata access and slower persistent storage.
Risk and Threat Considerations
SLRU itself is not an attack surface in the ordinary sense, but it can become relevant when database internal state is stressed, corrupted, or forced into inefficient access patterns. If the cache or the pages it serves are repeatedly churned, PostgreSQL may spend more time on metadata retrieval, increasing contention and reducing throughput.
Failure mechanism: A workload that repeatedly forces lookups of small internal pages can evict useful cached entries and push PostgreSQL back to disk reads, while corruption or instability in the underlying state can make those lookups more expensive or unreliable.
Impact: The practical result is higher latency on database housekeeping paths, more contention during concurrent activity, and in severe cases degraded availability for workloads that depend on fast transaction and lock metadata access.
Practitioner Guidance
What to watch for: Treat SLRU as part of the database's internal performance baseline, not as a separate feature to optimise in isolation. When latency rises around transaction-heavy or lock-heavy workloads, look at whether the database is repeatedly revisiting small metadata pages and whether the surrounding workload is creating avoidable churn.
Practitioner takeaway: SLRU usually matters most when internal metadata access stops being cheap, so performance review should focus on the workload pattern that drives that access, not just on the cache itself.
Related resources from NHI Mgmt Group
- What is the difference between request-scoped caching and a shared application cache?
- Why can file-integrity checks miss page-cache corruption exploits?
- How should security teams distinguish DNS cache problems from identity access failures?
- When should teams clear DNS cache during incident response?
Deepen Your Knowledge
Free weekly newsletter
Subscribe to the NHI & AI Identity Journal
The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.
Bonus 33% off our NHI Course when you subscribe.
Reviewed and updated by the NHIMG editorial team on November 25, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org