diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2006-04-25 22:46:05 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2006-04-25 22:46:05 +0000 |
commit | d2896a9ed14387912bffb6f7ed188aca0a245e71 (patch) | |
tree | 1956bb9b3157f5bbe8c78f948c4f5df782773195 /src/backend/utils/cache | |
parent | 89083876c9b409d604d1a7f704e1323547aef2c9 (diff) | |
download | postgresql-d2896a9ed14387912bffb6f7ed188aca0a245e71.tar.gz postgresql-d2896a9ed14387912bffb6f7ed188aca0a245e71.zip |
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.
Diffstat (limited to 'src/backend/utils/cache')
-rw-r--r-- | src/backend/utils/cache/relcache.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c index 6e4f1c5a0f6..878678be756 100644 --- a/src/backend/utils/cache/relcache.c +++ b/src/backend/utils/cache/relcache.c @@ -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)); /* |