Can't we give better table bloat stats easily? - Mailing list pgsql-hackers

From Greg Stark
Subject Can't we give better table bloat stats easily?
Date
Msg-id CAM-w4HNWw2qu+7PWCu25L15dswREU0OS1rWi7bHYiT6_zNu9Jg@mail.gmail.com
Whole thread Raw
Responses Re: Can't we give better table bloat stats easily?
Re: Can't we give better table bloat stats easily?
List pgsql-hackers
Everywhere I've worked I've seen people struggle with table bloat. It's hard to even measure how much of it you have or where, let alone actually fix it.

If you search online you'll find dozens of different queries estimating how much empty space are in your tables and indexes based on pg_stats statistics and suppositions about header lengths and padding and plugging them into formulas of varying credibility. 

But isn't this all just silliiness these days? We could actually sum up the space recorded in the fsm and get a much more trustworthy number in milliseconds. 

I rigged up a quick proof of concept and the code seems super simple and quick. There's one or two tables where the number is a bit suspect and there's no fsm if vacuum hasn't run but that seems pretty small potatoes for such a huge help in reducing user pain.


pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Unused header file inclusion
Next
From: Andres Freund
Date:
Subject: Re: Can't we give better table bloat stats easily?