<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Pg_stats on Postgres Scripts</title><link>https://www.postgresscripts.com/tags/pg_stats/</link><description>Recent content in Pg_stats on Postgres Scripts</description><generator>Hugo -- gohugo.io</generator><language>en</language><copyright>PostgresScripts.com</copyright><lastBuildDate>Wed, 01 Apr 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://www.postgresscripts.com/tags/pg_stats/index.xml" rel="self" type="application/rss+xml"/><item><title>Estimate PostgreSQL Table Bloat with SQL</title><link>https://www.postgresscripts.com/post/estimate-postgresql-table-bloat-with-sql/</link><pubDate>Wed, 01 Apr 2026 00:00:00 +0000</pubDate><guid>https://www.postgresscripts.com/post/estimate-postgresql-table-bloat-with-sql/</guid><description>
&lt;h2 id="how-to-estimate-table-bloat-in-postgresql"&gt;How to Estimate Table Bloat in PostgreSQL&lt;/h2&gt;
&lt;p&gt;When you update or delete rows in PostgreSQL, the old row versions are not removed immediately. They stay in the table as dead tuples until VACUUM cleans them up. Over time, if VACUUM does not keep up, these dead rows pile up and the table grows larger than it needs to be. This is called table bloat.&lt;/p&gt;
&lt;p&gt;Bloat wastes disk space and slows down queries because PostgreSQL has to read through more pages to find live data. This query estimates how much of each table is wasted space, so you can decide which tables need attention.&lt;/p&gt;</description></item><item><title>Find PostgreSQL Index Bloat and Wasted Space</title><link>https://www.postgresscripts.com/post/find-postgresql-index-bloat-and-wasted-space/</link><pubDate>Tue, 31 Mar 2026 00:00:00 +0000</pubDate><guid>https://www.postgresscripts.com/post/find-postgresql-index-bloat-and-wasted-space/</guid><description>
&lt;h2 id="how-to-find-index-bloat-and-wasted-space-in-postgresql"&gt;How to Find Index Bloat and Wasted Space in PostgreSQL&lt;/h2&gt;
&lt;p&gt;Just like tables, PostgreSQL indexes can become bloated over time. When rows are updated or deleted, the old index entries are not removed immediately. They stay in the index as dead entries, wasting space and slowing down index scans.&lt;/p&gt;
&lt;p&gt;B-tree indexes are the most common type in PostgreSQL and the most prone to bloat. This query estimates how much space is wasted in each B-tree index, so you can decide which ones need to be rebuilt.&lt;/p&gt;</description></item></channel></rss>