aboutsummaryrefslogtreecommitdiff
path: root/src/include/access/gist.h
diff options
context:
space:
mode:
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>2019-03-22 13:21:20 +0200
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>2019-03-22 13:21:45 +0200
commit7df159a620b760e289f1795b13542ed1b3e13b87 (patch)
treee4ca41fc59cf7263e32264791617b9ae5a2dca8e /src/include/access/gist.h
parentdf816f6ad532ad685a3897869a2e64d3a53fe312 (diff)
downloadpostgresql-7df159a620b760e289f1795b13542ed1b3e13b87.tar.gz
postgresql-7df159a620b760e289f1795b13542ed1b3e13b87.zip
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
Diffstat (limited to 'src/include/access/gist.h')
-rw-r--r--src/include/access/gist.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/include/access/gist.h b/src/include/access/gist.h
index 3234f241560..ce8bfd83ea4 100644
--- a/src/include/access/gist.h
+++ b/src/include/access/gist.h
@@ -151,6 +151,10 @@ typedef struct GISTENTRY
#define GistPageGetNSN(page) ( PageXLogRecPtrGet(GistPageGetOpaque(page)->nsn))
#define GistPageSetNSN(page, val) ( PageXLogRecPtrSet(GistPageGetOpaque(page)->nsn, val))
+/* For deleted pages we store last xid which could see the page in scan */
+#define GistPageGetDeleteXid(page) ( ((PageHeader) (page))->pd_prune_xid )
+#define GistPageSetDeleteXid(page, val) ( ((PageHeader) (page))->pd_prune_xid = val)
+
/*
* Vector of GISTENTRY structs; user-defined methods union and picksplit
* take it as one of their arguments