Thread: pgsql: Delete empty pages during GiST VACUUM.

pgsql: Delete empty pages during GiST VACUUM.

From
Heikki Linnakangas
Date:
Delete empty pages during GiST VACUUM.

To do this, we scan GiST two times. In the first pass we make note of
empty leaf pages and internal pages. At second pass we scan through
internal pages, looking for downlinks to the empty pages.

Deleting internal pages is still not supported, like in nbtree, the last
child of an internal page is never deleted. That means that if you have a
workload where new keys are always inserted to different area than where
old keys are removed, the index will still grow without bound. But the rate
of growth will be an order of magnitude slower than before.

Author: Andrey Borodin
Discussion: https://www.postgresql.org/message-id/B1E4DF12-6CD3-4706-BDBD-BF3283328F60@yandex-team.ru

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/7df159a620b760e289f1795b13542ed1b3e13b87

Modified Files
--------------
src/backend/access/gist/README         |  48 +++++
src/backend/access/gist/gist.c         |  15 ++
src/backend/access/gist/gistutil.c     |  34 ++-
src/backend/access/gist/gistvacuum.c   | 378 ++++++++++++++++++++++++++++++---
src/backend/access/gist/gistxlog.c     | 115 ++++++++++
src/backend/access/rmgrdesc/gistdesc.c |  28 +++
src/include/access/gist.h              |   4 +
src/include/access/gist_private.h      |  11 +-
src/include/access/gistxlog.h          |  30 ++-
src/test/regress/expected/gist.out     |   6 +-
src/test/regress/sql/gist.sql          |   6 +-
11 files changed, 626 insertions(+), 49 deletions(-)