summaryrefslogtreecommitdiff
path: root/src/backend/access/gin/gininsert.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2008-11-13 17:42:10 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2008-11-13 17:42:10 +0000
commit10e3acb8e7bd3298ba2b942f86c18f5ba2e142a8 (patch)
tree19bf64481b48aa0f21669a994958fb7c4be2645f /src/backend/access/gin/gininsert.c
parent3379fae6de5994b242cedfa48cf613ecfee3db24 (diff)
downloadpostgresql-10e3acb8e7bd3298ba2b942f86c18f5ba2e142a8.tar.gz
Prevent synchronous scan during GIN index build, because GIN is optimized
for inserting tuples in increasing TID order. It's not clear whether this fully explains Ivan Sergio Borgonovo's complaint, but simple testing confirms that a scan that doesn't start at block 0 can slow GIN build by a factor of three or four. Backpatch to 8.3. Sync scan didn't exist before that.
Diffstat (limited to 'src/backend/access/gin/gininsert.c')
-rw-r--r--src/backend/access/gin/gininsert.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/backend/access/gin/gininsert.c b/src/backend/access/gin/gininsert.c
index 64099cd1e5..6e0a194a69 100644
--- a/src/backend/access/gin/gininsert.c
+++ b/src/backend/access/gin/gininsert.c
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/gin/gininsert.c,v 1.15 2008/09/30 10:52:10 heikki Exp $
+ * $PostgreSQL: pgsql/src/backend/access/gin/gininsert.c,v 1.16 2008/11/13 17:42:09 tgl Exp $
*-------------------------------------------------------------------------
*/
@@ -340,8 +340,11 @@ ginbuild(PG_FUNCTION_ARGS)
buildstate.accum.ginstate = &buildstate.ginstate;
ginInitBA(&buildstate.accum);
- /* do the heap scan */
- reltuples = IndexBuildHeapScan(heap, index, indexInfo,
+ /*
+ * Do the heap scan. We disallow sync scan here because dataPlaceToPage
+ * prefers to receive tuples in TID order.
+ */
+ reltuples = IndexBuildHeapScan(heap, index, indexInfo, false,
ginBuildCallback, (void *) &buildstate);
/* dump remaining entries to the index */