1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-02 09:02:37 +03:00

Arrange to cache btree metapage data in the relcache entry for the index,

thereby saving a visit to the metapage in most index searches/updates.
This wouldn't actually save any I/O (since in the old regime the metapage
generally stayed in cache anyway), but it does provide a useful decrease
in bufmgr traffic in high-contention scenarios.  Per my recent proposal.
This commit is contained in:
Tom Lane
2006-04-25 22:46:05 +00:00
parent 89083876c9
commit d2896a9ed1
6 changed files with 122 additions and 9 deletions

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/cache/relcache.c,v 1.238 2006/03/05 15:58:45 momjian Exp $
* $PostgreSQL: pgsql/src/backend/utils/cache/relcache.c,v 1.239 2006/04/25 22:46:05 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -948,6 +948,7 @@ RelationInitIndexAccessInfo(Relation relation)
*/
relation->rd_indexprs = NIL;
relation->rd_indpred = NIL;
relation->rd_amcache = NULL;
}
/*
@ -1481,6 +1482,10 @@ RelationReloadClassinfo(Relation relation)
RelationInitPhysicalAddr(relation);
/* Make sure targblock is reset in case rel was truncated */
relation->rd_targblock = InvalidBlockNumber;
/* Must free any AM cached data, too */
if (relation->rd_amcache)
pfree(relation->rd_amcache);
relation->rd_amcache = NULL;
/* Okay, now it's valid again */
relation->rd_isvalid = true;
}
@ -3141,6 +3146,7 @@ load_relcache_init_file(void)
rel->rd_indexlist = NIL;
rel->rd_oidindex = InvalidOid;
rel->rd_createSubid = InvalidSubTransactionId;
rel->rd_amcache = NULL;
MemSet(&rel->pgstat_info, 0, sizeof(rel->pgstat_info));
/*