<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Pg_buffercache on Postgres Scripts</title><link>https://www.postgresscripts.com/tags/pg_buffercache/</link><description>Recent content in Pg_buffercache on Postgres Scripts</description><generator>Hugo -- gohugo.io</generator><language>en</language><copyright>PostgresScripts.com</copyright><lastBuildDate>Tue, 08 Sep 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://www.postgresscripts.com/tags/pg_buffercache/index.xml" rel="self" type="application/rss+xml"/><item><title>Summarize the Buffer Cache with pg_buffercache_summary</title><link>https://www.postgresscripts.com/post/summarize-buffer-cache-with-pg-buffercache-summary-function/</link><pubDate>Tue, 08 Sep 2026 00:00:00 +0000</pubDate><guid>https://www.postgresscripts.com/post/summarize-buffer-cache-with-pg-buffercache-summary-function/</guid><description>
&lt;h2 id="summarize-the-buffer-cache-with-pg_buffercache_summary"&gt;Summarize the Buffer Cache with pg_buffercache_summary&lt;/h2&gt;
&lt;p&gt;PostgreSQL 16 added a shortcut to a question DBAs have always had to answer the expensive way. Before that release, checking how full the shared buffer cache was — how many buffers were dirty, how many pinned, how hot the clock-sweep usage counts were running — meant scanning &lt;a href="https://www.postgresql.org/docs/current/pgbuffercache.html"&gt;pg_buffercache&lt;/a&gt;, one row per 8KB buffer, and aggregating the result yourself. &lt;code&gt;pg_buffercache_summary()&lt;/code&gt; collapses that scan into a single row: how many buffers are used, unused, dirty, and pinned, plus the average clock-sweep usage count across the whole cache — computed inside the function instead of pulled buffer-by-buffer into a client and summed by hand.&lt;/p&gt;</description></item></channel></rss>