]> granicus.if.org Git - postgresql/commit
Make gistvacuumcleanup() count the actual number of index tuples.
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 2 Mar 2018 16:22:42 +0000 (11:22 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 2 Mar 2018 16:22:42 +0000 (11:22 -0500)
commitccd650430db6168aaaae0b28702e11caf7781bf4
tree54488d6453133c1a3159f8012853efa0bac1ba59
parent2b2c5aae90fa59260ed54f9ea91ee27d135ef5a1
Make gistvacuumcleanup() count the actual number of index tuples.

Previously, it just returned the heap tuple count, which might be only an
estimate, and would be completely the wrong thing if the index is partial.
Since this function scans every index page anyway to find free pages,
it's practically free to count the surviving index tuples.  Let's do that
and return an accurate count.

This is easily visible as a wrong reltuples value for a partial GiST
index following VACUUM, so back-patch to all supported branches.

Andrey Borodin, reviewed by Michail Nikolaev

Discussion: https://postgr.es/m/151956654251.6915.675951950408204404.pgcf@coridan.postgresql.org
src/backend/access/gist/gistvacuum.c