diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2008-11-13 17:42:19 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2008-11-13 17:42:19 +0000 |
commit | b608b24245cb3acffac6f596107a8ffab6880ae6 (patch) | |
tree | 25705a494e620874c68418e94015954f3184d789 /src/backend/access/gin/gininsert.c | |
parent | 940c412d7fe1ac9fc779d4f3f181f4928da90ba6 (diff) |
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.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/backend/access/gin/gininsert.c b/src/backend/access/gin/gininsert.c index a20687f7032..31af4a82f1d 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.11 2008/01/01 19:45:46 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/access/gin/gininsert.c,v 1.11.2.1 2008/11/13 17:42:18 tgl Exp $ *------------------------------------------------------------------------- */ @@ -326,8 +326,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); oldCtx = MemoryContextSwitchTo(buildstate.tmpCtx); |