aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/cache/syscache.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2010-02-08 05:53:55 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2010-02-08 05:53:55 +0000
commit9a75803b1a4ba01c1e02284146fa7cf8a0cf8cd1 (patch)
treeed4cfb7a33d80d0ea5662aa9ac4f05301f0698e4 /src/backend/utils/cache/syscache.c
parent68446b2c87a2aee5d8c2eb2aade7bb6d4195b7e1 (diff)
downloadpostgresql-9a75803b1a4ba01c1e02284146fa7cf8a0cf8cd1.tar.gz
postgresql-9a75803b1a4ba01c1e02284146fa7cf8a0cf8cd1.zip
Remove CatalogCacheFlushRelation, and the reloidattr infrastructure that was
needed by nothing else. The restructuring I just finished doing on cache management exposed to me how silly this routine was. Its function was to go into the catcache and blow away all entries related to a given relation when there was a relcache flush on that relation. However, there is no point in removing a catcache entry if the catalog row it represents is still valid --- and if it isn't valid, there must have been a catcache entry flush on it, because that's triggered directly by heap_update or heap_delete on the catalog row. So this routine accomplished nothing except to blow away valid cache entries that we'd very likely be wanting in the near future to help reconstruct the relcache entry. Dumb. On top of which, it required a subtle and easy-to-get-wrong attribute in syscache definitions, ie, the column containing the OID of the related relation if any. Removing that is a very useful maintenance simplification.
Diffstat (limited to 'src/backend/utils/cache/syscache.c')
-rw-r--r--src/backend/utils/cache/syscache.c68
1 files changed, 3 insertions, 65 deletions
diff --git a/src/backend/utils/cache/syscache.c b/src/backend/utils/cache/syscache.c
index f35712732b2..c04db4f02f9 100644
--- a/src/backend/utils/cache/syscache.c
+++ b/src/backend/utils/cache/syscache.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/cache/syscache.c,v 1.124 2010/01/05 21:53:59 rhaas Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/cache/syscache.c,v 1.125 2010/02/08 05:53:55 tgl Exp $
*
* NOTES
* These routines allow the parser/planner/executor to perform
@@ -64,12 +64,8 @@
Add your entry to the cacheinfo[] array below. All cache lists are
alphabetical, so add it in the proper place. Specify the relation OID,
- index OID, number of keys, key attribute numbers, and number of hash
- buckets. If the relation contains tuples that are associated with a
- particular relation (for example, its attributes, rules, triggers, etc)
- then specify the attribute number that contains the OID of the associated
- relation. This is used by CatalogCacheFlushRelation() to remove the
- correct tuples during a table drop or relcache invalidation event.
+ index OID, number of keys, key attribute numbers, and initial number of
+ hash buckets.
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
@@ -98,7 +94,6 @@ struct cachedesc
{
Oid reloid; /* OID of the relation being cached */
Oid indoid; /* OID of index relation for this cache */
- int reloidattr; /* attr number of rel OID reference, or 0 */
int nkeys; /* # of keys needed for cache lookup */
int key[4]; /* attribute numbers of key attrs */
int nbuckets; /* number of hash buckets for this cache */
@@ -107,7 +102,6 @@ struct cachedesc
static const struct cachedesc cacheinfo[] = {
{AggregateRelationId, /* AGGFNOID */
AggregateFnoidIndexId,
- 0,
1,
{
Anum_pg_aggregate_aggfnoid,
@@ -119,7 +113,6 @@ static const struct cachedesc cacheinfo[] = {
},
{AccessMethodRelationId, /* AMNAME */
AmNameIndexId,
- 0,
1,
{
Anum_pg_am_amname,
@@ -131,7 +124,6 @@ static const struct cachedesc cacheinfo[] = {
},
{AccessMethodRelationId, /* AMOID */
AmOidIndexId,
- 0,
1,
{
ObjectIdAttributeNumber,
@@ -143,7 +135,6 @@ static const struct cachedesc cacheinfo[] = {
},
{AccessMethodOperatorRelationId, /* AMOPOPID */
AccessMethodOperatorIndexId,
- 0,
2,
{
Anum_pg_amop_amopopr,
@@ -155,7 +146,6 @@ static const struct cachedesc cacheinfo[] = {
},
{AccessMethodOperatorRelationId, /* AMOPSTRATEGY */
AccessMethodStrategyIndexId,
- 0,
4,
{
Anum_pg_amop_amopfamily,
@@ -167,7 +157,6 @@ static const struct cachedesc cacheinfo[] = {
},
{AccessMethodProcedureRelationId, /* AMPROCNUM */
AccessMethodProcedureIndexId,
- 0,
4,
{
Anum_pg_amproc_amprocfamily,
@@ -179,7 +168,6 @@ static const struct cachedesc cacheinfo[] = {
},
{AttributeRelationId, /* ATTNAME */
AttributeRelidNameIndexId,
- Anum_pg_attribute_attrelid,
2,
{
Anum_pg_attribute_attrelid,
@@ -191,7 +179,6 @@ static const struct cachedesc cacheinfo[] = {
},
{AttributeRelationId, /* ATTNUM */
AttributeRelidNumIndexId,
- Anum_pg_attribute_attrelid,
2,
{
Anum_pg_attribute_attrelid,
@@ -203,7 +190,6 @@ static const struct cachedesc cacheinfo[] = {
},
{AuthMemRelationId, /* AUTHMEMMEMROLE */
AuthMemMemRoleIndexId,
- 0,
2,
{
Anum_pg_auth_members_member,
@@ -215,7 +201,6 @@ static const struct cachedesc cacheinfo[] = {
},
{AuthMemRelationId, /* AUTHMEMROLEMEM */
AuthMemRoleMemIndexId,
- 0,
2,
{
Anum_pg_auth_members_roleid,
@@ -227,7 +212,6 @@ static const struct cachedesc cacheinfo[] = {
},
{AuthIdRelationId, /* AUTHNAME */
AuthIdRolnameIndexId,
- 0,
1,
{
Anum_pg_authid_rolname,
@@ -239,7 +223,6 @@ static const struct cachedesc cacheinfo[] = {
},
{AuthIdRelationId, /* AUTHOID */
AuthIdOidIndexId,
- 0,
1,
{
ObjectIdAttributeNumber,
@@ -252,7 +235,6 @@ static const struct cachedesc cacheinfo[] = {
{
CastRelationId, /* CASTSOURCETARGET */
CastSourceTargetIndexId,
- 0,
2,
{
Anum_pg_cast_castsource,
@@ -264,7 +246,6 @@ static const struct cachedesc cacheinfo[] = {
},
{OperatorClassRelationId, /* CLAAMNAMENSP */
OpclassAmNameNspIndexId,
- 0,
3,
{
Anum_pg_opclass_opcmethod,
@@ -276,7 +257,6 @@ static const struct cachedesc cacheinfo[] = {
},
{OperatorClassRelationId, /* CLAOID */
OpclassOidIndexId,
- 0,
1,
{
ObjectIdAttributeNumber,
@@ -288,7 +268,6 @@ static const struct cachedesc cacheinfo[] = {
},
{ConversionRelationId, /* CONDEFAULT */
ConversionDefaultIndexId,
- 0,
4,
{
Anum_pg_conversion_connamespace,
@@ -300,7 +279,6 @@ static const struct cachedesc cacheinfo[] = {
},
{ConversionRelationId, /* CONNAMENSP */
ConversionNameNspIndexId,
- 0,
2,
{
Anum_pg_conversion_conname,
@@ -312,7 +290,6 @@ static const struct cachedesc cacheinfo[] = {
},
{ConstraintRelationId, /* CONSTROID */
ConstraintOidIndexId,
- Anum_pg_constraint_conrelid,
1,
{
ObjectIdAttributeNumber,
@@ -324,7 +301,6 @@ static const struct cachedesc cacheinfo[] = {
},
{ConversionRelationId, /* CONVOID */
ConversionOidIndexId,
- 0,
1,
{
ObjectIdAttributeNumber,
@@ -336,7 +312,6 @@ static const struct cachedesc cacheinfo[] = {
},
{DatabaseRelationId, /* DATABASEOID */
DatabaseOidIndexId,
- 0,
1,
{
ObjectIdAttributeNumber,
@@ -348,7 +323,6 @@ static const struct cachedesc cacheinfo[] = {
},
{DefaultAclRelationId, /* DEFACLROLENSPOBJ */
DefaultAclRoleNspObjIndexId,
- 0,
3,
{
Anum_pg_default_acl_defaclrole,
@@ -360,7 +334,6 @@ static const struct cachedesc cacheinfo[] = {
},
{EnumRelationId, /* ENUMOID */
EnumOidIndexId,
- 0,
1,
{
ObjectIdAttributeNumber,
@@ -372,7 +345,6 @@ static const struct cachedesc cacheinfo[] = {
},
{EnumRelationId, /* ENUMTYPOIDNAME */
EnumTypIdLabelIndexId,
- 0,
2,
{
Anum_pg_enum_enumtypid,
@@ -384,7 +356,6 @@ static const struct cachedesc cacheinfo[] = {
},
{ForeignDataWrapperRelationId, /* FOREIGNDATAWRAPPERNAME */
ForeignDataWrapperNameIndexId,
- 0,
1,
{
Anum_pg_foreign_data_wrapper_fdwname,
@@ -396,7 +367,6 @@ static const struct cachedesc cacheinfo[] = {
},
{ForeignDataWrapperRelationId, /* FOREIGNDATAWRAPPEROID */
ForeignDataWrapperOidIndexId,
- 0,
1,
{
ObjectIdAttributeNumber,
@@ -408,7 +378,6 @@ static const struct cachedesc cacheinfo[] = {
},
{ForeignServerRelationId, /* FOREIGNSERVERNAME */
ForeignServerNameIndexId,
- 0,
1,
{
Anum_pg_foreign_server_srvname,
@@ -420,7 +389,6 @@ static const struct cachedesc cacheinfo[] = {
},
{ForeignServerRelationId, /* FOREIGNSERVEROID */
ForeignServerOidIndexId,
- 0,
1,
{
ObjectIdAttributeNumber,
@@ -432,7 +400,6 @@ static const struct cachedesc cacheinfo[] = {
},
{IndexRelationId, /* INDEXRELID */
IndexRelidIndexId,
- Anum_pg_index_indrelid,
1,
{
Anum_pg_index_indexrelid,
@@ -444,7 +411,6 @@ static const struct cachedesc cacheinfo[] = {
},
{LanguageRelationId, /* LANGNAME */
LanguageNameIndexId,
- 0,
1,
{
Anum_pg_language_lanname,
@@ -456,7 +422,6 @@ static const struct cachedesc cacheinfo[] = {
},
{LanguageRelationId, /* LANGOID */
LanguageOidIndexId,
- 0,
1,
{
ObjectIdAttributeNumber,
@@ -468,7 +433,6 @@ static const struct cachedesc cacheinfo[] = {
},
{NamespaceRelationId, /* NAMESPACENAME */
NamespaceNameIndexId,
- 0,
1,
{
Anum_pg_namespace_nspname,
@@ -480,7 +444,6 @@ static const struct cachedesc cacheinfo[] = {
},
{NamespaceRelationId, /* NAMESPACEOID */
NamespaceOidIndexId,
- 0,
1,
{
ObjectIdAttributeNumber,
@@ -492,7 +455,6 @@ static const struct cachedesc cacheinfo[] = {
},
{OperatorRelationId, /* OPERNAMENSP */
OperatorNameNspIndexId,
- 0,
4,
{
Anum_pg_operator_oprname,
@@ -504,7 +466,6 @@ static const struct cachedesc cacheinfo[] = {
},
{OperatorRelationId, /* OPEROID */
OperatorOidIndexId,
- 0,
1,
{
ObjectIdAttributeNumber,
@@ -516,7 +477,6 @@ static const struct cachedesc cacheinfo[] = {
},
{OperatorFamilyRelationId, /* OPFAMILYAMNAMENSP */
OpfamilyAmNameNspIndexId,
- 0,
3,
{
Anum_pg_opfamily_opfmethod,
@@ -528,7 +488,6 @@ static const struct cachedesc cacheinfo[] = {
},
{OperatorFamilyRelationId, /* OPFAMILYOID */
OpfamilyOidIndexId,
- 0,
1,
{
ObjectIdAttributeNumber,
@@ -540,7 +499,6 @@ static const struct cachedesc cacheinfo[] = {
},
{ProcedureRelationId, /* PROCNAMEARGSNSP */
ProcedureNameArgsNspIndexId,
- 0,
3,
{
Anum_pg_proc_proname,
@@ -552,7 +510,6 @@ static const struct cachedesc cacheinfo[] = {
},
{ProcedureRelationId, /* PROCOID */
ProcedureOidIndexId,
- 0,
1,
{
ObjectIdAttributeNumber,
@@ -564,7 +521,6 @@ static const struct cachedesc cacheinfo[] = {
},
{RelationRelationId, /* RELNAMENSP */
ClassNameNspIndexId,
- ObjectIdAttributeNumber,
2,
{
Anum_pg_class_relname,
@@ -576,7 +532,6 @@ static const struct cachedesc cacheinfo[] = {
},
{RelationRelationId, /* RELOID */
ClassOidIndexId,
- ObjectIdAttributeNumber,
1,
{
ObjectIdAttributeNumber,
@@ -588,7 +543,6 @@ static const struct cachedesc cacheinfo[] = {
},
{RewriteRelationId, /* RULERELNAME */
RewriteRelRulenameIndexId,
- Anum_pg_rewrite_ev_class,
2,
{
Anum_pg_rewrite_ev_class,
@@ -600,7 +554,6 @@ static const struct cachedesc cacheinfo[] = {
},
{StatisticRelationId, /* STATRELATTINH */
StatisticRelidAttnumInhIndexId,
- Anum_pg_statistic_starelid,
3,
{
Anum_pg_statistic_starelid,
@@ -612,7 +565,6 @@ static const struct cachedesc cacheinfo[] = {
},
{TableSpaceRelationId, /* TABLESPACEOID */
TablespaceOidIndexId,
- 0,
1,
{
ObjectIdAttributeNumber,
@@ -624,7 +576,6 @@ static const struct cachedesc cacheinfo[] = {
},
{TSConfigMapRelationId, /* TSCONFIGMAP */
TSConfigMapIndexId,
- 0,
3,
{
Anum_pg_ts_config_map_mapcfg,
@@ -636,7 +587,6 @@ static const struct cachedesc cacheinfo[] = {
},
{TSConfigRelationId, /* TSCONFIGNAMENSP */
TSConfigNameNspIndexId,
- 0,
2,
{
Anum_pg_ts_config_cfgname,
@@ -648,7 +598,6 @@ static const struct cachedesc cacheinfo[] = {
},
{TSConfigRelationId, /* TSCONFIGOID */
TSConfigOidIndexId,
- 0,
1,
{
ObjectIdAttributeNumber,
@@ -660,7 +609,6 @@ static const struct cachedesc cacheinfo[] = {
},
{TSDictionaryRelationId, /* TSDICTNAMENSP */
TSDictionaryNameNspIndexId,
- 0,
2,
{
Anum_pg_ts_dict_dictname,
@@ -672,7 +620,6 @@ static const struct cachedesc cacheinfo[] = {
},
{TSDictionaryRelationId, /* TSDICTOID */
TSDictionaryOidIndexId,
- 0,
1,
{
ObjectIdAttributeNumber,
@@ -684,7 +631,6 @@ static const struct cachedesc cacheinfo[] = {
},
{TSParserRelationId, /* TSPARSERNAMENSP */
TSParserNameNspIndexId,
- 0,
2,
{
Anum_pg_ts_parser_prsname,
@@ -696,7 +642,6 @@ static const struct cachedesc cacheinfo[] = {
},
{TSParserRelationId, /* TSPARSEROID */
TSParserOidIndexId,
- 0,
1,
{
ObjectIdAttributeNumber,
@@ -708,7 +653,6 @@ static const struct cachedesc cacheinfo[] = {
},
{TSTemplateRelationId, /* TSTEMPLATENAMENSP */
TSTemplateNameNspIndexId,
- 0,
2,
{
Anum_pg_ts_template_tmplname,
@@ -720,7 +664,6 @@ static const struct cachedesc cacheinfo[] = {
},
{TSTemplateRelationId, /* TSTEMPLATEOID */
TSTemplateOidIndexId,
- 0,
1,
{
ObjectIdAttributeNumber,
@@ -732,7 +675,6 @@ static const struct cachedesc cacheinfo[] = {
},
{TypeRelationId, /* TYPENAMENSP */
TypeNameNspIndexId,
- Anum_pg_type_typrelid,
2,
{
Anum_pg_type_typname,
@@ -744,7 +686,6 @@ static const struct cachedesc cacheinfo[] = {
},
{TypeRelationId, /* TYPEOID */
TypeOidIndexId,
- Anum_pg_type_typrelid,
1,
{
ObjectIdAttributeNumber,
@@ -756,7 +697,6 @@ static const struct cachedesc cacheinfo[] = {
},
{UserMappingRelationId, /* USERMAPPINGOID */
UserMappingOidIndexId,
- 0,
1,
{
ObjectIdAttributeNumber,
@@ -768,7 +708,6 @@ static const struct cachedesc cacheinfo[] = {
},
{UserMappingRelationId, /* USERMAPPINGUSERSERVER */
UserMappingUserServerIndexId,
- 0,
2,
{
Anum_pg_user_mapping_umuser,
@@ -808,7 +747,6 @@ InitCatalogCache(void)
SysCache[cacheId] = InitCatCache(cacheId,
cacheinfo[cacheId].reloid,
cacheinfo[cacheId].indoid,
- cacheinfo[cacheId].reloidattr,
cacheinfo[cacheId].nkeys,
cacheinfo[cacheId].key,
cacheinfo[cacheId].nbuckets);