Commit 8b9bc234 authored by Tom Lane's avatar Tom Lane

Remove the limit on the number of entries allowed in catcaches, and

remove the infrastructure needed to enforce the limit, ie, the global
LRU list of cache entries.  On small-to-middling databases this wins
because maintaining the LRU list is a waste of time.  On large databases
this wins because it's better to keep more cache entries (we assume
such users can afford to use some more per-backend memory than was
contemplated in the Berkeley-era catcache design).  This provides a
noticeable improvement in the speed of psql \d on a 10000-table
database, though it doesn't make it instantaneous.

While at it, use per-catcache settings for the number of hash buckets
per catcache, rather than the former one-size-fits-all value.  It's a
bit silly to be using the same number of hash buckets for, eg, pg_am
and pg_attribute.  The specific values I used might need some tuning,
but they seem to be in the right ballpark based on CATCACHE_STATS
results from the standard regression tests.
parent e1e133f2
This diff is collapsed.
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/cache/syscache.c,v 1.103 2006/05/03 22:45:26 tgl Exp $ * $PostgreSQL: pgsql/src/backend/utils/cache/syscache.c,v 1.104 2006/06/15 02:08:09 tgl Exp $
* *
* NOTES * NOTES
* These routines allow the parser/planner/executor to perform * These routines allow the parser/planner/executor to perform
...@@ -55,14 +55,18 @@ ...@@ -55,14 +55,18 @@
the list sorted alphabetically and adjust the cache numbers the list sorted alphabetically and adjust the cache numbers
accordingly. accordingly.
Add your entry to the cacheinfo[] array below. All cache lists are Add your entry to the cacheinfo[] array below. All cache lists are
alphabetical, so add it in the proper place. Specify the relation alphabetical, so add it in the proper place. Specify the relation OID,
OID, index OID, number of keys, and key attribute numbers. If the index OID, number of keys, key attribute numbers, and number of hash
relation contains tuples that are associated with a particular relation buckets. If the relation contains tuples that are associated with a
(for example, its attributes, rules, triggers, etc) then specify the particular relation (for example, its attributes, rules, triggers, etc)
attribute number that contains the OID of the associated relation. then specify the attribute number that contains the OID of the associated
This is used by CatalogCacheFlushRelation() to remove the correct relation. This is used by CatalogCacheFlushRelation() to remove the
tuples during a table drop or relcache invalidation event. correct tuples during a table drop or relcache invalidation event.
The number of hash buckets must be a power of 2. It's reasonable to
set this to the number of entries that might be in the particular cache
in a medium-size database.
There must be a unique index underlying each syscache (ie, an index There must be a unique index underlying each syscache (ie, an index
whose key is the same as that of the cache). If there is not one whose key is the same as that of the cache). If there is not one
...@@ -90,6 +94,7 @@ struct cachedesc ...@@ -90,6 +94,7 @@ struct cachedesc
int reloidattr; /* attr number of rel OID reference, or 0 */ int reloidattr; /* attr number of rel OID reference, or 0 */
int nkeys; /* # of keys needed for cache lookup */ int nkeys; /* # of keys needed for cache lookup */
int key[4]; /* attribute numbers of key attrs */ int key[4]; /* attribute numbers of key attrs */
int nbuckets; /* number of hash buckets for this cache */
}; };
static const struct cachedesc cacheinfo[] = { static const struct cachedesc cacheinfo[] = {
...@@ -102,7 +107,9 @@ static const struct cachedesc cacheinfo[] = { ...@@ -102,7 +107,9 @@ static const struct cachedesc cacheinfo[] = {
0, 0,
0, 0,
0 0
}}, },
32
},
{AccessMethodRelationId, /* AMNAME */ {AccessMethodRelationId, /* AMNAME */
AmNameIndexId, AmNameIndexId,
0, 0,
...@@ -112,7 +119,9 @@ static const struct cachedesc cacheinfo[] = { ...@@ -112,7 +119,9 @@ static const struct cachedesc cacheinfo[] = {
0, 0,
0, 0,
0 0
}}, },
4
},
{AccessMethodRelationId, /* AMOID */ {AccessMethodRelationId, /* AMOID */
AmOidIndexId, AmOidIndexId,
0, 0,
...@@ -122,7 +131,9 @@ static const struct cachedesc cacheinfo[] = { ...@@ -122,7 +131,9 @@ static const struct cachedesc cacheinfo[] = {
0, 0,
0, 0,
0 0
}}, },
4
},
{AccessMethodOperatorRelationId, /* AMOPOPID */ {AccessMethodOperatorRelationId, /* AMOPOPID */
AccessMethodOperatorIndexId, AccessMethodOperatorIndexId,
0, 0,
...@@ -132,7 +143,9 @@ static const struct cachedesc cacheinfo[] = { ...@@ -132,7 +143,9 @@ static const struct cachedesc cacheinfo[] = {
Anum_pg_amop_amopclaid, Anum_pg_amop_amopclaid,
0, 0,
0 0
}}, },
64
},
{AccessMethodOperatorRelationId, /* AMOPSTRATEGY */ {AccessMethodOperatorRelationId, /* AMOPSTRATEGY */
AccessMethodStrategyIndexId, AccessMethodStrategyIndexId,
0, 0,
...@@ -142,7 +155,9 @@ static const struct cachedesc cacheinfo[] = { ...@@ -142,7 +155,9 @@ static const struct cachedesc cacheinfo[] = {
Anum_pg_amop_amopsubtype, Anum_pg_amop_amopsubtype,
Anum_pg_amop_amopstrategy, Anum_pg_amop_amopstrategy,
0 0
}}, },
64
},
{AccessMethodProcedureRelationId, /* AMPROCNUM */ {AccessMethodProcedureRelationId, /* AMPROCNUM */
AccessMethodProcedureIndexId, AccessMethodProcedureIndexId,
0, 0,
...@@ -152,7 +167,9 @@ static const struct cachedesc cacheinfo[] = { ...@@ -152,7 +167,9 @@ static const struct cachedesc cacheinfo[] = {
Anum_pg_amproc_amprocsubtype, Anum_pg_amproc_amprocsubtype,
Anum_pg_amproc_amprocnum, Anum_pg_amproc_amprocnum,
0 0
}}, },
64
},
{AttributeRelationId, /* ATTNAME */ {AttributeRelationId, /* ATTNAME */
AttributeRelidNameIndexId, AttributeRelidNameIndexId,
Anum_pg_attribute_attrelid, Anum_pg_attribute_attrelid,
...@@ -162,7 +179,9 @@ static const struct cachedesc cacheinfo[] = { ...@@ -162,7 +179,9 @@ static const struct cachedesc cacheinfo[] = {
Anum_pg_attribute_attname, Anum_pg_attribute_attname,
0, 0,
0 0
}}, },
2048
},
{AttributeRelationId, /* ATTNUM */ {AttributeRelationId, /* ATTNUM */
AttributeRelidNumIndexId, AttributeRelidNumIndexId,
Anum_pg_attribute_attrelid, Anum_pg_attribute_attrelid,
...@@ -172,7 +191,9 @@ static const struct cachedesc cacheinfo[] = { ...@@ -172,7 +191,9 @@ static const struct cachedesc cacheinfo[] = {
Anum_pg_attribute_attnum, Anum_pg_attribute_attnum,
0, 0,
0 0
}}, },
2048
},
{AuthMemRelationId, /* AUTHMEMMEMROLE */ {AuthMemRelationId, /* AUTHMEMMEMROLE */
AuthMemMemRoleIndexId, AuthMemMemRoleIndexId,
0, 0,
...@@ -182,7 +203,9 @@ static const struct cachedesc cacheinfo[] = { ...@@ -182,7 +203,9 @@ static const struct cachedesc cacheinfo[] = {
Anum_pg_auth_members_roleid, Anum_pg_auth_members_roleid,
0, 0,
0 0
}}, },
128
},
{AuthMemRelationId, /* AUTHMEMROLEMEM */ {AuthMemRelationId, /* AUTHMEMROLEMEM */
AuthMemRoleMemIndexId, AuthMemRoleMemIndexId,
0, 0,
...@@ -192,7 +215,9 @@ static const struct cachedesc cacheinfo[] = { ...@@ -192,7 +215,9 @@ static const struct cachedesc cacheinfo[] = {
Anum_pg_auth_members_member, Anum_pg_auth_members_member,
0, 0,
0 0
}}, },
128
},
{AuthIdRelationId, /* AUTHNAME */ {AuthIdRelationId, /* AUTHNAME */
AuthIdRolnameIndexId, AuthIdRolnameIndexId,
0, 0,
...@@ -202,7 +227,9 @@ static const struct cachedesc cacheinfo[] = { ...@@ -202,7 +227,9 @@ static const struct cachedesc cacheinfo[] = {
0, 0,
0, 0,
0 0
}}, },
128
},
{AuthIdRelationId, /* AUTHOID */ {AuthIdRelationId, /* AUTHOID */
AuthIdOidIndexId, AuthIdOidIndexId,
0, 0,
...@@ -212,7 +239,9 @@ static const struct cachedesc cacheinfo[] = { ...@@ -212,7 +239,9 @@ static const struct cachedesc cacheinfo[] = {
0, 0,
0, 0,
0 0
}}, },
128
},
{ {
CastRelationId, /* CASTSOURCETARGET */ CastRelationId, /* CASTSOURCETARGET */
CastSourceTargetIndexId, CastSourceTargetIndexId,
...@@ -223,7 +252,9 @@ static const struct cachedesc cacheinfo[] = { ...@@ -223,7 +252,9 @@ static const struct cachedesc cacheinfo[] = {
Anum_pg_cast_casttarget, Anum_pg_cast_casttarget,
0, 0,
0 0
}}, },
256
},
{OperatorClassRelationId, /* CLAAMNAMENSP */ {OperatorClassRelationId, /* CLAAMNAMENSP */
OpclassAmNameNspIndexId, OpclassAmNameNspIndexId,
0, 0,
...@@ -233,7 +264,9 @@ static const struct cachedesc cacheinfo[] = { ...@@ -233,7 +264,9 @@ static const struct cachedesc cacheinfo[] = {
Anum_pg_opclass_opcname, Anum_pg_opclass_opcname,
Anum_pg_opclass_opcnamespace, Anum_pg_opclass_opcnamespace,
0 0
}}, },
64
},
{OperatorClassRelationId, /* CLAOID */ {OperatorClassRelationId, /* CLAOID */
OpclassOidIndexId, OpclassOidIndexId,
0, 0,
...@@ -243,7 +276,9 @@ static const struct cachedesc cacheinfo[] = { ...@@ -243,7 +276,9 @@ static const struct cachedesc cacheinfo[] = {
0, 0,
0, 0,
0 0
}}, },
64
},
{ConversionRelationId, /* CONDEFAULT */ {ConversionRelationId, /* CONDEFAULT */
ConversionDefaultIndexId, ConversionDefaultIndexId,
0, 0,
...@@ -253,7 +288,9 @@ static const struct cachedesc cacheinfo[] = { ...@@ -253,7 +288,9 @@ static const struct cachedesc cacheinfo[] = {
Anum_pg_conversion_conforencoding, Anum_pg_conversion_conforencoding,
Anum_pg_conversion_contoencoding, Anum_pg_conversion_contoencoding,
ObjectIdAttributeNumber, ObjectIdAttributeNumber,
}}, },
128
},
{ConversionRelationId, /* CONNAMENSP */ {ConversionRelationId, /* CONNAMENSP */
ConversionNameNspIndexId, ConversionNameNspIndexId,
0, 0,
...@@ -263,7 +300,9 @@ static const struct cachedesc cacheinfo[] = { ...@@ -263,7 +300,9 @@ static const struct cachedesc cacheinfo[] = {
Anum_pg_conversion_connamespace, Anum_pg_conversion_connamespace,
0, 0,
0 0
}}, },
128
},
{ConversionRelationId, /* CONOID */ {ConversionRelationId, /* CONOID */
ConversionOidIndexId, ConversionOidIndexId,
0, 0,
...@@ -273,7 +312,9 @@ static const struct cachedesc cacheinfo[] = { ...@@ -273,7 +312,9 @@ static const struct cachedesc cacheinfo[] = {
0, 0,
0, 0,
0 0
}}, },
128
},
{DatabaseRelationId, /* DATABASEOID */ {DatabaseRelationId, /* DATABASEOID */
DatabaseOidIndexId, DatabaseOidIndexId,
0, 0,
...@@ -283,7 +324,9 @@ static const struct cachedesc cacheinfo[] = { ...@@ -283,7 +324,9 @@ static const struct cachedesc cacheinfo[] = {
0, 0,
0, 0,
0 0
}}, },
4
},
{IndexRelationId, /* INDEXRELID */ {IndexRelationId, /* INDEXRELID */
IndexRelidIndexId, IndexRelidIndexId,
Anum_pg_index_indrelid, Anum_pg_index_indrelid,
...@@ -293,7 +336,9 @@ static const struct cachedesc cacheinfo[] = { ...@@ -293,7 +336,9 @@ static const struct cachedesc cacheinfo[] = {
0, 0,
0, 0,
0 0
}}, },
1024
},
{InheritsRelationId, /* INHRELID */ {InheritsRelationId, /* INHRELID */
InheritsRelidSeqnoIndexId, InheritsRelidSeqnoIndexId,
Anum_pg_inherits_inhrelid, Anum_pg_inherits_inhrelid,
...@@ -303,7 +348,9 @@ static const struct cachedesc cacheinfo[] = { ...@@ -303,7 +348,9 @@ static const struct cachedesc cacheinfo[] = {
Anum_pg_inherits_inhseqno, Anum_pg_inherits_inhseqno,
0, 0,
0 0
}}, },
256
},
{LanguageRelationId, /* LANGNAME */ {LanguageRelationId, /* LANGNAME */
LanguageNameIndexId, LanguageNameIndexId,
0, 0,
...@@ -313,7 +360,9 @@ static const struct cachedesc cacheinfo[] = { ...@@ -313,7 +360,9 @@ static const struct cachedesc cacheinfo[] = {
0, 0,
0, 0,
0 0
}}, },
4
},
{LanguageRelationId, /* LANGOID */ {LanguageRelationId, /* LANGOID */
LanguageOidIndexId, LanguageOidIndexId,
0, 0,
...@@ -323,7 +372,9 @@ static const struct cachedesc cacheinfo[] = { ...@@ -323,7 +372,9 @@ static const struct cachedesc cacheinfo[] = {
0, 0,
0, 0,
0 0
}}, },
4
},
{NamespaceRelationId, /* NAMESPACENAME */ {NamespaceRelationId, /* NAMESPACENAME */
NamespaceNameIndexId, NamespaceNameIndexId,
0, 0,
...@@ -333,7 +384,9 @@ static const struct cachedesc cacheinfo[] = { ...@@ -333,7 +384,9 @@ static const struct cachedesc cacheinfo[] = {
0, 0,
0, 0,
0 0
}}, },
256
},
{NamespaceRelationId, /* NAMESPACEOID */ {NamespaceRelationId, /* NAMESPACEOID */
NamespaceOidIndexId, NamespaceOidIndexId,
0, 0,
...@@ -343,7 +396,9 @@ static const struct cachedesc cacheinfo[] = { ...@@ -343,7 +396,9 @@ static const struct cachedesc cacheinfo[] = {
0, 0,
0, 0,
0 0
}}, },
256
},
{OperatorRelationId, /* OPERNAMENSP */ {OperatorRelationId, /* OPERNAMENSP */
OperatorNameNspIndexId, OperatorNameNspIndexId,
0, 0,
...@@ -353,7 +408,9 @@ static const struct cachedesc cacheinfo[] = { ...@@ -353,7 +408,9 @@ static const struct cachedesc cacheinfo[] = {
Anum_pg_operator_oprleft, Anum_pg_operator_oprleft,
Anum_pg_operator_oprright, Anum_pg_operator_oprright,
Anum_pg_operator_oprnamespace Anum_pg_operator_oprnamespace
}}, },
1024
},
{OperatorRelationId, /* OPEROID */ {OperatorRelationId, /* OPEROID */
OperatorOidIndexId, OperatorOidIndexId,
0, 0,
...@@ -363,7 +420,9 @@ static const struct cachedesc cacheinfo[] = { ...@@ -363,7 +420,9 @@ static const struct cachedesc cacheinfo[] = {
0, 0,
0, 0,
0 0
}}, },
1024
},
{ProcedureRelationId, /* PROCNAMEARGSNSP */ {ProcedureRelationId, /* PROCNAMEARGSNSP */
ProcedureNameArgsNspIndexId, ProcedureNameArgsNspIndexId,
0, 0,
...@@ -373,7 +432,9 @@ static const struct cachedesc cacheinfo[] = { ...@@ -373,7 +432,9 @@ static const struct cachedesc cacheinfo[] = {
Anum_pg_proc_proargtypes, Anum_pg_proc_proargtypes,
Anum_pg_proc_pronamespace, Anum_pg_proc_pronamespace,
0 0
}}, },
2048
},
{ProcedureRelationId, /* PROCOID */ {ProcedureRelationId, /* PROCOID */
ProcedureOidIndexId, ProcedureOidIndexId,
0, 0,
...@@ -383,7 +444,9 @@ static const struct cachedesc cacheinfo[] = { ...@@ -383,7 +444,9 @@ static const struct cachedesc cacheinfo[] = {
0, 0,
0, 0,
0 0
}}, },
2048
},
{RelationRelationId, /* RELNAMENSP */ {RelationRelationId, /* RELNAMENSP */
ClassNameNspIndexId, ClassNameNspIndexId,
ObjectIdAttributeNumber, ObjectIdAttributeNumber,
...@@ -393,7 +456,9 @@ static const struct cachedesc cacheinfo[] = { ...@@ -393,7 +456,9 @@ static const struct cachedesc cacheinfo[] = {
Anum_pg_class_relnamespace, Anum_pg_class_relnamespace,
0, 0,
0 0
}}, },
1024
},
{RelationRelationId, /* RELOID */ {RelationRelationId, /* RELOID */
ClassOidIndexId, ClassOidIndexId,
ObjectIdAttributeNumber, ObjectIdAttributeNumber,
...@@ -403,7 +468,9 @@ static const struct cachedesc cacheinfo[] = { ...@@ -403,7 +468,9 @@ static const struct cachedesc cacheinfo[] = {
0, 0,
0, 0,
0 0
}}, },
1024
},
{RewriteRelationId, /* RULERELNAME */ {RewriteRelationId, /* RULERELNAME */
RewriteRelRulenameIndexId, RewriteRelRulenameIndexId,
Anum_pg_rewrite_ev_class, Anum_pg_rewrite_ev_class,
...@@ -413,7 +480,9 @@ static const struct cachedesc cacheinfo[] = { ...@@ -413,7 +480,9 @@ static const struct cachedesc cacheinfo[] = {
Anum_pg_rewrite_rulename, Anum_pg_rewrite_rulename,
0, 0,
0 0
}}, },
1024
},
{StatisticRelationId, /* STATRELATT */ {StatisticRelationId, /* STATRELATT */
StatisticRelidAttnumIndexId, StatisticRelidAttnumIndexId,
Anum_pg_statistic_starelid, Anum_pg_statistic_starelid,
...@@ -423,7 +492,9 @@ static const struct cachedesc cacheinfo[] = { ...@@ -423,7 +492,9 @@ static const struct cachedesc cacheinfo[] = {
Anum_pg_statistic_staattnum, Anum_pg_statistic_staattnum,
0, 0,
0 0
}}, },
1024
},
{TypeRelationId, /* TYPENAMENSP */ {TypeRelationId, /* TYPENAMENSP */
TypeNameNspIndexId, TypeNameNspIndexId,
Anum_pg_type_typrelid, Anum_pg_type_typrelid,
...@@ -433,7 +504,9 @@ static const struct cachedesc cacheinfo[] = { ...@@ -433,7 +504,9 @@ static const struct cachedesc cacheinfo[] = {
Anum_pg_type_typnamespace, Anum_pg_type_typnamespace,
0, 0,
0 0
}}, },
1024
},
{TypeRelationId, /* TYPEOID */ {TypeRelationId, /* TYPEOID */
TypeOidIndexId, TypeOidIndexId,
Anum_pg_type_typrelid, Anum_pg_type_typrelid,
...@@ -443,11 +516,12 @@ static const struct cachedesc cacheinfo[] = { ...@@ -443,11 +516,12 @@ static const struct cachedesc cacheinfo[] = {
0, 0,
0, 0,
0 0
}} },
1024
}
}; };
static CatCache *SysCache[ static CatCache *SysCache[lengthof(cacheinfo)];
lengthof(cacheinfo)];
static int SysCacheSize = lengthof(cacheinfo); static int SysCacheSize = lengthof(cacheinfo);
static bool CacheInitialized = false; static bool CacheInitialized = false;
...@@ -476,7 +550,8 @@ InitCatalogCache(void) ...@@ -476,7 +550,8 @@ InitCatalogCache(void)
cacheinfo[cacheId].indoid, cacheinfo[cacheId].indoid,
cacheinfo[cacheId].reloidattr, cacheinfo[cacheId].reloidattr,
cacheinfo[cacheId].nkeys, cacheinfo[cacheId].nkeys,
cacheinfo[cacheId].key); cacheinfo[cacheId].key,
cacheinfo[cacheId].nbuckets);
if (!PointerIsValid(SysCache[cacheId])) if (!PointerIsValid(SysCache[cacheId]))
elog(ERROR, "could not initialize cache %u (%d)", elog(ERROR, "could not initialize cache %u (%d)",
cacheinfo[cacheId].reloid, cacheId); cacheinfo[cacheId].reloid, cacheId);
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/include/utils/catcache.h,v 1.58 2006/03/05 15:59:07 momjian Exp $ * $PostgreSQL: pgsql/src/include/utils/catcache.h,v 1.59 2006/06/15 02:08:09 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -60,7 +60,6 @@ typedef struct catcache ...@@ -60,7 +60,6 @@ typedef struct catcache
* searches, each of which will result in loading a negative entry * searches, each of which will result in loading a negative entry
*/ */
long cc_invals; /* # of entries invalidated from cache */ long cc_invals; /* # of entries invalidated from cache */
long cc_discards; /* # of entries discarded due to overflow */
long cc_lsearches; /* total # list-searches */ long cc_lsearches; /* total # list-searches */
long cc_lhits; /* # of matches against existing lists */ long cc_lhits; /* # of matches against existing lists */
#endif #endif
...@@ -75,11 +74,10 @@ typedef struct catctup ...@@ -75,11 +74,10 @@ typedef struct catctup
CatCache *my_cache; /* link to owning catcache */ CatCache *my_cache; /* link to owning catcache */
/* /*
* Each tuple in a cache is a member of two Dllists: one lists all the * Each tuple in a cache is a member of a Dllist that stores the elements
* elements in all the caches in LRU order, and the other lists just the * of its hash bucket. We keep each Dllist in LRU order to speed repeated
* elements in one hashbucket of one cache, also in LRU order. * lookups.
*/ */
Dlelem lrulist_elem; /* list member of global LRU list */
Dlelem cache_elem; /* list member of per-bucket list */ Dlelem cache_elem; /* list member of per-bucket list */
/* /*
...@@ -125,9 +123,8 @@ typedef struct catclist ...@@ -125,9 +123,8 @@ typedef struct catclist
* table rows satisfying the partial key. (Note: none of these will be * table rows satisfying the partial key. (Note: none of these will be
* negative cache entries.) * negative cache entries.)
* *
* A CatCList is only a member of a per-cache list; we do not do separate * A CatCList is only a member of a per-cache list; we do not currently
* LRU management for CatCLists. See CatalogCacheCleanup() for the * divide them into hash buckets.
* details of the management algorithm.
* *
* A list marked "dead" must not be returned by subsequent searches. * A list marked "dead" must not be returned by subsequent searches.
* However, it won't be physically deleted from the cache until its * However, it won't be physically deleted from the cache until its
...@@ -143,7 +140,6 @@ typedef struct catclist ...@@ -143,7 +140,6 @@ typedef struct catclist
int refcount; /* number of active references */ int refcount; /* number of active references */
bool dead; /* dead but not yet removed? */ bool dead; /* dead but not yet removed? */
bool ordered; /* members listed in index order? */ bool ordered; /* members listed in index order? */
bool touched; /* used since last CatalogCacheCleanup? */
short nkeys; /* number of lookup keys specified */ short nkeys; /* number of lookup keys specified */
uint32 hash_value; /* hash value for lookup keys */ uint32 hash_value; /* hash value for lookup keys */
HeapTupleData tuple; /* header for tuple holding keys */ HeapTupleData tuple; /* header for tuple holding keys */
...@@ -156,8 +152,6 @@ typedef struct catcacheheader ...@@ -156,8 +152,6 @@ typedef struct catcacheheader
{ {
CatCache *ch_caches; /* head of list of CatCache structs */ CatCache *ch_caches; /* head of list of CatCache structs */
int ch_ntup; /* # of tuples in all caches */ int ch_ntup; /* # of tuples in all caches */
int ch_maxtup; /* max # of tuples allowed (LRU) */
Dllist ch_lrulist; /* overall LRU list, most recent first */
} CatCacheHeader; } CatCacheHeader;
...@@ -169,7 +163,8 @@ extern void AtEOXact_CatCache(bool isCommit); ...@@ -169,7 +163,8 @@ extern void AtEOXact_CatCache(bool isCommit);
extern CatCache *InitCatCache(int id, Oid reloid, Oid indexoid, extern CatCache *InitCatCache(int id, Oid reloid, Oid indexoid,
int reloidattr, int reloidattr,
int nkeys, const int *key); int nkeys, const int *key,
int nbuckets);
extern void InitCatCachePhase2(CatCache *cache); extern void InitCatCachePhase2(CatCache *cache);
extern HeapTuple SearchCatCache(CatCache *cache, extern HeapTuple SearchCatCache(CatCache *cache,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment