summaryrefslogtreecommitdiff
path: root/src/backend/nodes/tidbitmap.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2009-03-24 20:17:18 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2009-03-24 20:17:18 +0000
commitff301d6e690bb5581502ea3d8591a1600fd87acc (patch)
tree9fd8b2fa00cf35f8b2e66b0960e7e9ca90dfaa66 /src/backend/nodes/tidbitmap.c
parent9987f66001ef7f59dd8f8c92295732dba5507c4f (diff)
Implement "fastupdate" support for GIN indexes, in which we try to accumulate
multiple index entries in a holding area before adding them to the main index structure. This helps because bulk insert is (usually) significantly faster than retail insert for GIN. This patch also removes GIN support for amgettuple-style index scans. The API defined for amgettuple is difficult to support with fastupdate, and the previously committed partial-match feature didn't really work with it either. We might eventually figure a way to put back amgettuple support, but it won't happen for 8.4. catversion bumped because of change in GIN's pg_am entry, and because the format of GIN indexes changed on-disk (there's a metapage now, and possibly a pending list). Teodor Sigaev
Diffstat (limited to 'src/backend/nodes/tidbitmap.c')
-rw-r--r--src/backend/nodes/tidbitmap.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/backend/nodes/tidbitmap.c b/src/backend/nodes/tidbitmap.c
index e214bbb7634..e56b4696b4f 100644
--- a/src/backend/nodes/tidbitmap.c
+++ b/src/backend/nodes/tidbitmap.c
@@ -32,7 +32,7 @@
* Copyright (c) 2003-2009, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/nodes/tidbitmap.c,v 1.17 2009/01/10 21:08:36 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/nodes/tidbitmap.c,v 1.18 2009/03/24 20:17:14 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -310,6 +310,22 @@ tbm_add_tuples(TIDBitmap *tbm, const ItemPointer tids, int ntids,
}
/*
+ * tbm_add_page - add a whole page to a TIDBitmap
+ *
+ * This causes the whole page to be reported (with the recheck flag)
+ * when the TIDBitmap is scanned.
+ */
+void
+tbm_add_page(TIDBitmap *tbm, BlockNumber pageno)
+{
+ /* Enter the page in the bitmap, or mark it lossy if already present */
+ tbm_mark_page_lossy(tbm, pageno);
+ /* If we went over the memory limit, lossify some more pages */
+ if (tbm->nentries > tbm->maxentries)
+ tbm_lossify(tbm);
+}
+
+/*
* tbm_union - set union
*
* a is modified in-place, b is not changed
@@ -496,7 +512,7 @@ tbm_intersect_page(TIDBitmap *a, PagetableEntry *apage, const TIDBitmap *b)
{
/*
* Some of the tuples in 'a' might not satisfy the quals for 'b',
- * but because the page 'b' is lossy, we don't know which ones.
+ * but because the page 'b' is lossy, we don't know which ones.
* Therefore we mark 'a' as requiring rechecks, to indicate that
* at most those tuples set in 'a' are matches.
*/