diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2006-05-10 23:18:39 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2006-05-10 23:18:39 +0000 |
commit | 3fdeb189e977ebe29ee658592d07930e016dd031 (patch) | |
tree | 1233c6b5d693bbfb76839b502692465d09d28421 /src/backend/access/gist/gist.c | |
parent | c1f39437d0ad38d1f8d76f9ebf904faa9a7aaaf6 (diff) | |
download | postgresql-3fdeb189e977ebe29ee658592d07930e016dd031.tar.gz postgresql-3fdeb189e977ebe29ee658592d07930e016dd031.zip |
Clean up code associated with updating pg_class statistics columns
(relpages/reltuples). To do this, create formal support in heapam.c for
"overwrite" tuple updates (including xlog replay capability) and use that
instead of the ad-hoc overwrites we'd been using in VACUUM and CREATE INDEX.
Take the responsibility for updating stats during CREATE INDEX out of the
individual index AMs, and do it where it belongs, in catalog/index.c. Aside
from being more modular, this avoids having to update the same tuple twice in
some paths through CREATE INDEX. It's probably not measurably faster, but
for sure it's a lot cleaner than before.
Diffstat (limited to 'src/backend/access/gist/gist.c')
-rw-r--r-- | src/backend/access/gist/gist.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/backend/access/gist/gist.c b/src/backend/access/gist/gist.c index 2272e3339d1..4ce461d4463 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.133 2006/05/10 09:19:54 teodor Exp $ + * $PostgreSQL: pgsql/src/backend/access/gist/gist.c,v 1.134 2006/05/10 23:18:38 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -89,6 +89,7 @@ gistbuild(PG_FUNCTION_ARGS) Relation heap = (Relation) PG_GETARG_POINTER(0); Relation index = (Relation) PG_GETARG_POINTER(1); IndexInfo *indexInfo = (IndexInfo *) PG_GETARG_POINTER(2); + IndexBuildResult *result; double reltuples; GISTBuildState buildstate; Buffer buffer; @@ -154,12 +155,17 @@ gistbuild(PG_FUNCTION_ARGS) /* okay, all heap tuples are indexed */ MemoryContextDelete(buildstate.tmpCtx); - /* since we just counted the # of tuples, may as well update stats */ - IndexCloseAndUpdateStats(heap, reltuples, index, buildstate.indtuples); - freeGISTstate(&buildstate.giststate); - PG_RETURN_VOID(); + /* + * Return statistics + */ + result = (IndexBuildResult *) palloc(sizeof(IndexBuildResult)); + + result->heap_tuples = reltuples; + result->index_tuples = buildstate.indtuples; + + PG_RETURN_POINTER(result); } /* |