Delete empty pages in each pass during GIST VACUUM.
authorAmit Kapila <akapila@postgresql.org>
Mon, 13 Jan 2020 02:29:44 +0000 (07:59 +0530)
committerAmit Kapila <akapila@postgresql.org>
Mon, 13 Jan 2020 02:29:44 +0000 (07:59 +0530)
commit4e514c6180fbf71cf7a0171867c828c63afd1c37
tree5c304c4d5cfc1834f1d19d0b8c837bdf0a3cc691
parenteae056c19ee8f5ebc45ac0fe13181f91c8791e00
Delete empty pages in each pass during GIST VACUUM.

Earlier, we use to postpone deleting empty pages till the second stage of
vacuum to amortize the cost of scanning internal pages.  However, that can
sometimes (say vacuum is canceled or errored between first and second
stage) delay the pages to be recycled.

Another thing is that to facilitate deleting empty pages in the second
stage, we need to share the information about internal and empty pages
between different stages of vacuum.  It will be quite tricky to share this
information via DSM which is required for the upcoming parallel vacuum
patch.

Also, it will bring the logic to reclaim deleted pages closer to nbtree
where we delete empty pages in each pass.

Overall, the advantages of deleting empty pages in each pass outweigh the
advantages of postponing the same.

Author: Dilip Kumar, with changes by Amit Kapila
Reviewed-by: Sawada Masahiko and Amit Kapila
Discussion: https://postgr.es/m/CAA4eK1LGr+MN0xHZpJ2dfS8QNQ1a_aROKowZB+MPNep8FVtwAA@mail.gmail.com
src/backend/access/gist/README
src/backend/access/gist/gistvacuum.c