From b608b24245cb3acffac6f596107a8ffab6880ae6 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Thu, 13 Nov 2008 17:42:19 +0000 Subject: 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. --- src/backend/access/gist/gist.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/backend/access/gist/gist.c') diff --git a/src/backend/access/gist/gist.c b/src/backend/access/gist/gist.c index 91b8fe4d055..26f3ddbf853 100644 --- a/src/backend/access/gist/gist.c +++ b/src/backend/access/gist/gist.c @@ -8,7 +8,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/gist/gist.c,v 1.149 2008/01/01 19:45:46 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/access/gist/gist.c,v 1.149.2.1 2008/11/13 17:42:18 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -147,7 +147,7 @@ gistbuild(PG_FUNCTION_ARGS) buildstate.tmpCtx = createTempGistContext(); /* do the heap scan */ - reltuples = IndexBuildHeapScan(heap, index, indexInfo, + reltuples = IndexBuildHeapScan(heap, index, indexInfo, true, gistbuildCallback, (void *) &buildstate); /* okay, all heap tuples are indexed */ -- cgit v1.2.3