From f933766ba7c5446a28d714904ae0c46d8b21b86a Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Tue, 21 Aug 2001 16:36:06 +0000 Subject: Restructure pg_opclass, pg_amop, and pg_amproc per previous discussions in pgsql-hackers. pg_opclass now has a row for each opclass supported by each index AM, not a row for each opclass name. This allows pg_opclass to show directly whether an AM supports an opclass, and furthermore makes it possible to store additional information about an opclass that might be AM-dependent. pg_opclass and pg_amop now store "lossy" and "haskeytype" information that we previously expected the user to remember to provide in CREATE INDEX commands. Lossiness is no longer an index-level property, but is associated with the use of a particular operator in a particular index opclass. Along the way, IndexSupportInitialize now uses the syscaches to retrieve pg_amop and pg_amproc entries. I find this reduces backend launch time by about ten percent, at the cost of a couple more special cases in catcache.c's IndexScanOK. Initial work by Oleg Bartunov and Teodor Sigaev, further hacking by Tom Lane. initdb forced. --- src/backend/utils/cache/catcache.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'src/backend/utils/cache/catcache.c') diff --git a/src/backend/utils/cache/catcache.c b/src/backend/utils/cache/catcache.c index f5f16e7718..ce4363706b 100644 --- a/src/backend/utils/cache/catcache.c +++ b/src/backend/utils/cache/catcache.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.81 2001/06/22 19:16:23 wieck Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.82 2001/08/21 16:36:04 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -18,6 +18,7 @@ #include "access/hash.h" #include "access/heapam.h" #include "access/valid.h" +#include "catalog/pg_opclass.h" #include "catalog/pg_operator.h" #include "catalog/pg_type.h" #include "catalog/catname.h" @@ -812,7 +813,7 @@ IndexScanOK(CatCache *cache, ScanKey cur_skey) sd = heap_beginscan(rel, false, SnapshotNow, 1, &key); ntp = heap_getnext(sd, 0); if (!HeapTupleIsValid(ntp)) - elog(ERROR, "SearchSelfReferences: %s not found in %s", + elog(ERROR, "IndexScanOK: %s not found in %s", IndexRelidIndex, RelationRelationName); indexSelfOid = ntp->t_data->t_oid; heap_endscan(sd); @@ -823,6 +824,16 @@ IndexScanOK(CatCache *cache, ScanKey cur_skey) if (DatumGetObjectId(cur_skey[0].sk_argument) == indexSelfOid) return false; } + else if (cache->id == AMOPSTRATEGY || + cache->id == AMPROCNUM) + { + /* Looking for an OID or INT2 btree operator or function? */ + Oid lookup_oid = DatumGetObjectId(cur_skey[0].sk_argument); + + if (lookup_oid == OID_BTREE_OPS_OID || + lookup_oid == INT2_BTREE_OPS_OID) + return false; + } else if (cache->id == OPEROID) { /* Looking for an OID comparison function? */ @@ -858,7 +869,7 @@ SearchCatCache(CatCache *cache, MemoryContext oldcxt; /* - * one-time startup overhead + * one-time startup overhead for each cache */ if (cache->cc_tupdesc == NULL) CatalogCacheInitializeCache(cache); -- cgit v1.2.1