On 11/21/23 21:48, Bruce Momjian wrote: > On Tue, Mar 27, 2018 at 08:58:11PM +0900, Masahiko Sawada wrote: >> ... >> >> If I understand correctly pg_class.reltuples of indexes should have >> the number of index tuples but especially for brin indexes it would be >> hard to estimate it in the analyze code. I thought that we can change >> brinvacuumcleanup so that it returns the estimated number of index >> tuples and do vac_update_relstats using that value but it would break >> API contract. Better ideas? > > I assume there is nothing to do on this issue. >
I'm not sure. I think the current behavior is (still) wrong - I just rediscovered it during testing BRIN. I haven't checked, but I guess GIN is still affected too. What's not clear to me is if this is merely cosmetic issue (making pg_class data confusing for people), or if it has some practical impact. And I'm not sure there's a good way to improve this, except for some basic guesswork. For BRIN I can imagine simply calculating the number of page ranges (relpages / pages_per_range), but no idea about GIN. regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company