pgsql-bloat-estimation icon indicating copy to clipboard operation
pgsql-bloat-estimation copied to clipboard

Toasted text

Open Krysztophe opened this issue 5 years ago • 1 comments

As discussed today on daliconsultants:

In pg_stats, toasted data is exactly 18 bytes when data is totally toasted. So the query computes that the bloat is higher than real.

Perhaps is it possible to exclude text columns with 18.0 bytes and an extended/external storage ? That would not solve the case for columns with very different sizes, where avg_width is a mix of 18 and real sizes.

Krysztophe avatar May 04 '20 14:05 Krysztophe

Hi,

for now, I added some explanation in the README.

Perhaps is it possible to exclude text columns with 18.0 bytes and an extended/external storage ?

Any idea and PoC is appreciated. However, it is not possible to know exactly what field in what row has been toasted away... Moreover, excluding a field from a table is not enough as we would not be able to compute the expected size of the table anyway. We would have to exclude the whole table using eg. is_na. Lastly, what if 50% of a field has been toasted? or even 99% ? The average size will not be 18, but the computed expected size will still be far off...

ioguix avatar Aug 17 '20 15:08 ioguix