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

Use live_tuples instead of reltuples

Open ioguix opened this issue 8 years ago • 7 comments

See discussion: https://www.postgresql.org/message-id/flat/16db4468-edfa-830a-f921-39a50498e77e%402ndquadrant.com#[email protected]

ioguix avatar Jul 28 '17 08:07 ioguix

Maybe this commit will change query's result : https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=7c91a0364fcf5d739a09cc87e7adb1d4a33ed112

anayrat avatar Mar 25 '18 16:03 anayrat

So based on the commits, we can assume that the current versions of PG v10+ are OK now, right?

MichaelDBA avatar Jul 07 '22 12:07 MichaelDBA

Hi,

As I understand the discussion on pgsql-hackers, this patch hasn't been back-patched to v10. So it's OK for v11 and after.

ioguix avatar Jul 07 '22 13:07 ioguix

Thanks!

MichaelDBA avatar Jul 07 '22 14:07 MichaelDBA

hi ioguix, after I REINDEX an index, the output bloat_size about the index doesn't change. I think the reltuples doesn't update after REINDEX. My question is what columns could I use instead of reltuples? which table the live_tuples is in you said?

shangzixie avatar Aug 22 '22 17:08 shangzixie

Hi @shangzixie,

It comes from pg_stat_all_tables.n_live_tup.

after I REINDEX an index, the output bloat_size about the index doesn't change.

On what version are you testing? Could you share your scenario?

ioguix avatar Aug 23 '22 09:08 ioguix

Hi @shangzixie,

It comes from pg_stat_all_tables.n_live_tup.

after I REINDEX an index, the output bloat_size about the index doesn't change.

On what version are you testing? Could you share your scenario?

just, run your sql and reindex some table. Oh, I found need to ANALYZE, so as to update reltuples.

shangzixie avatar Aug 26 '22 07:08 shangzixie