Can't we give better table bloat stats easily?

From: Greg Stark <stark(at)mit(dot)edu>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Can't we give better table bloat stats easily?
Date: 2019-08-17 00:39:21
Message-ID: CAM-w4HNWw2qu+7PWCu25L15dswREU0OS1rWi7bHYiT6_zNu9Jg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2019-08-17 00:59:12 Re: Can't we give better table bloat stats easily?
Previous Message Andres Freund 2019-08-16 23:07:16 Re: Unused header file inclusion