1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-27 07:42:10 +03:00

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.
This commit is contained in:
Tom Lane
2006-05-10 23:18:39 +00:00
parent c1f39437d0
commit 3fdeb189e9
17 changed files with 519 additions and 404 deletions

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/catalog/heap.c,v 1.298 2006/04/30 01:08:06 momjian Exp $
* $PostgreSQL: pgsql/src/backend/catalog/heap.c,v 1.299 2006/05/10 23:18:39 tgl Exp $
*
*
* INTERFACE ROUTINES
@@ -1921,17 +1921,14 @@ RelationTruncateIndexes(Oid heapId)
RelationTruncate(currentIndex, 0);
/* Initialize the index and rebuild */
index_build(heapRelation, currentIndex, indexInfo);
/* Note: we do not need to re-establish pkey or toast settings */
index_build(heapRelation, currentIndex, indexInfo, false, false);
/*
* index_build will close both the heap and index relations (but not
* give up the locks we hold on them). We're done with this index,
* but we must re-open the heap rel.
*/
heapRelation = heap_open(heapId, NoLock);
/* We're done with this index */
index_close(currentIndex);
}
/* Finish by closing the heap rel again */
/* And now done with the heap; but keep lock until commit */
heap_close(heapRelation, NoLock);
}