<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Cache on Postgres Scripts</title><link>https://www.postgresscripts.com/tags/cache/</link><description>Recent content in Cache on Postgres Scripts</description><generator>Hugo -- gohugo.io</generator><language>en</language><copyright>PostgresScripts.com</copyright><lastBuildDate>Thu, 14 May 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://www.postgresscripts.com/tags/cache/index.xml" rel="self" type="application/rss+xml"/><item><title>Monitor PostgreSQL Table Cache Hit Ratio with SQL</title><link>https://www.postgresscripts.com/post/postgresql-table-cache-hit-ratio-pg-statio-user-tables/</link><pubDate>Thu, 14 May 2026 00:00:00 +0000</pubDate><guid>https://www.postgresscripts.com/post/postgresql-table-cache-hit-ratio-pg-statio-user-tables/</guid><description>
&lt;h2 id="measuring-postgresql-table-cache-efficiency-with-pg_statio_user_tables"&gt;Measuring PostgreSQL Table Cache Efficiency with pg_statio_user_tables&lt;/h2&gt;
&lt;p&gt;PostgreSQL keeps frequently accessed data pages in &lt;code&gt;shared_buffers&lt;/code&gt; to avoid hitting disk. When a backend reads a data block, PostgreSQL first checks &lt;code&gt;shared_buffers&lt;/code&gt;; if the block is there, it counts as a heap hit. If it is not, PostgreSQL reads from disk and counts it as a heap read. The ratio of hits to total reads — the table cache hit ratio — is a primary indicator of how well your &lt;code&gt;shared_buffers&lt;/code&gt; setting matches your working data set.&lt;/p&gt;</description></item></channel></rss>