aboutsummaryrefslogtreecommitdiff
path: root/src/include/access/gist_private.h
diff options
context:
space:
mode:
authorTeodor Sigaev <teodor@sigaev.ru>2015-09-09 18:43:37 +0300
committerTeodor Sigaev <teodor@sigaev.ru>2015-09-09 18:43:37 +0300
commit013ebc0a7b7ea9c1b1ab7a3d4dd75ea121ea8ba7 (patch)
treef22d59c51b1df33681b4dcc9e7160b6e6c0fa446 /src/include/access/gist_private.h
parent96f6a0cb41ee06673960019f0026b1b0fd1e644d (diff)
downloadpostgresql-013ebc0a7b7ea9c1b1ab7a3d4dd75ea121ea8ba7.tar.gz
postgresql-013ebc0a7b7ea9c1b1ab7a3d4dd75ea121ea8ba7.zip
Microvacuum for GIST
Mark index tuple as dead if it's pointed by kill_prior_tuple during ordinary (search) scan and remove it during insert process if there is no enough space for new tuple to insert. This improves select performance because index will not return tuple marked as dead and improves insert performance because it reduces number of page split. Anastasia Lubennikova <a.lubennikova@postgrespro.ru> with minor editorialization by me
Diffstat (limited to 'src/include/access/gist_private.h')
-rw-r--r--src/include/access/gist_private.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/include/access/gist_private.h b/src/include/access/gist_private.h
index 4f1a5c33eae..1a77982391e 100644
--- a/src/include/access/gist_private.h
+++ b/src/include/access/gist_private.h
@@ -22,6 +22,7 @@
#include "storage/bufmgr.h"
#include "storage/buffile.h"
#include "utils/hsearch.h"
+#include "access/genam.h"
/*
* Maximum number of "halves" a page can be split into in one operation.
@@ -121,9 +122,11 @@ typedef struct GISTSearchHeapItem
{
ItemPointerData heapPtr;
bool recheck; /* T if quals must be rechecked */
- bool recheckDistances; /* T if distances must be rechecked */
+ bool recheckDistances; /* T if distances must be rechecked */
IndexTuple ftup; /* data fetched back from the index, used in
* index-only scans */
+ OffsetNumber offnum; /* track offset in page to mark tuple as
+ * LP_DEAD */
} GISTSearchHeapItem;
/* Unvisited item, either index page or heap tuple */
@@ -161,6 +164,12 @@ typedef struct GISTScanOpaqueData
/* pre-allocated workspace arrays */
double *distances; /* output area for gistindex_keytest */
+ /* info about killed items if any (killedItems is NULL if never used) */
+ OffsetNumber *killedItems; /* offset numbers of killed items */
+ int numKilled; /* number of currently stored items */
+ BlockNumber curBlkno; /* current number of block */
+ GistNSN curPageLSN; /* pos in the WAL stream when page was read */
+
/* In a non-ordered search, returnable heap items are stored here: */
GISTSearchHeapItem pageData[BLCKSZ / sizeof(IndexTupleData)];
OffsetNumber nPageData; /* number of valid items in array */