summaryrefslogtreecommitdiff
path: root/src/backend/utils/cache/syscache.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2002-08-05 03:29:17 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2002-08-05 03:29:17 +0000
commit15fe086fba52bbac7560151e06d1efb3daa69e4a (patch)
treef4213b8a0a5f0be0a4b3c990b5063b800961551f /src/backend/utils/cache/syscache.c
parent07f9682de43ce53fcd6d86744f610cacfabc60bb (diff)
Restructure system-catalog index updating logic. Instead of having
hardwired lists of index names for each catalog, use the relcache's mechanism for caching lists of OIDs of indexes of any table. This reduces the common case of updating system catalog indexes to a single line, makes it much easier to add a new system index (in fact, you can now do so on-the-fly if you want to), and as a nice side benefit improves performance a little. Per recent pghackers discussion.
Diffstat (limited to 'src/backend/utils/cache/syscache.c')
-rw-r--r--src/backend/utils/cache/syscache.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/backend/utils/cache/syscache.c b/src/backend/utils/cache/syscache.c
index c9b68b1d8d4..357829bee51 100644
--- a/src/backend/utils/cache/syscache.c
+++ b/src/backend/utils/cache/syscache.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/cache/syscache.c,v 1.85 2002/08/02 18:15:08 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/syscache.c,v 1.86 2002/08/05 03:29:17 tgl Exp $
*
* NOTES
* These routines allow the parser/planner/executor to perform
@@ -64,18 +64,16 @@
This is used by CatalogCacheFlushRelation() to remove the correct
tuples during a table drop or relcache invalidation event.
- In include/catalog/indexing.h, add a define for the number of indexes
- on the relation, add define(s) for the index name(s), add an extern
- array to hold the index names, and use DECLARE_UNIQUE_INDEX to define
- the index. Cache lookups return only one row, so the index should be
- unique in most cases.
-
- In backend/catalog/indexing.c, initialize the relation array with
- the index names for the relation.
+ 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
+ already, add definitions for it to include/catalog/indexing.h: you
+ need a #define for the index name and a DECLARE_UNIQUE_INDEX macro
+ with the actual declaration. (This will require a catversion.h update,
+ while simply adding/deleting caches only requires a recompile.)
Finally, any place your relation gets heap_insert() or
- heap_update calls, include code to do a CatalogIndexInsert() to update
- the system indexes. The heap_* calls do not update indexes.
+ heap_update calls, make sure there is a CatalogUpdateIndexes() or
+ similar call. The heap_* calls do not update indexes.
bjm 1999/11/22