summaryrefslogtreecommitdiff
path: root/src/include/utils/catcache.h
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2002-02-19 20:11:20 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2002-02-19 20:11:20 +0000
commit786340441706ac1957a031f11ad1c2e5b6e18314 (patch)
tree4e6b689b96778e42e6cc679169f71dc180049e04 /src/include/utils/catcache.h
parent8e2998d8a6aebc2a3b22e6048fab8abe1c95f1f0 (diff)
downloadpostgresql-786340441706ac1957a031f11ad1c2e5b6e18314.tar.gz
A bunch of changes aimed at reducing backend startup time...
Improve 'pg_internal.init' relcache entry preload mechanism so that it is safe to use for all system catalogs, and arrange to preload a realistic set of system-catalog entries instead of only the three nailed-in-cache indexes that were formerly loaded this way. Fix mechanism for deleting out-of-date pg_internal.init files: this must be synchronized with transaction commit, not just done at random times within transactions. Drive it off relcache invalidation mechanism so that no special-case tests are needed. Cache additional information in relcache entries for indexes (their pg_index tuples and index-operator OIDs) to eliminate repeated lookups. Also cache index opclass info at the per-opclass level to avoid repeated lookups during relcache load. Generalize 'systable scan' utilities originally developed by Hiroshi, move them into genam.c, use in a number of places where there was formerly ugly code for choosing either heap or index scan. In particular this allows simplification of the logic that prevents infinite recursion between syscache and relcache during startup: we can easily switch to heapscans in relcache.c when and where needed to avoid recursion, so IndexScanOK becomes simpler and does not need any expensive initialization. Eliminate useless opening of a heapscan data structure while doing an indexscan (this saves an mdnblocks call and thus at least one kernel call).
Diffstat (limited to 'src/include/utils/catcache.h')
-rw-r--r--src/include/utils/catcache.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/include/utils/catcache.h b/src/include/utils/catcache.h
index de5957441a..6ad0d74851 100644
--- a/src/include/utils/catcache.h
+++ b/src/include/utils/catcache.h
@@ -13,7 +13,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: catcache.h,v 1.37 2001/11/05 17:46:36 momjian Exp $
+ * $Id: catcache.h,v 1.38 2002/02/19 20:11:19 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -44,6 +44,12 @@ typedef struct catcache
int cc_key[4]; /* AttrNumber of each key */
PGFunction cc_hashfunc[4]; /* hash function to use for each key */
ScanKeyData cc_skey[4]; /* precomputed key info for heap scans */
+#ifdef CATCACHE_STATS
+ long cc_searches; /* total # searches against this cache */
+ long cc_hits; /* # of matches against existing entry */
+ long cc_newloads; /* # of successful loads of new entry */
+ /* cc_searches - (cc_hits + cc_newloads) is # of failed searches */
+#endif
Dllist cc_bucket[1]; /* hash buckets --- VARIABLE LENGTH ARRAY */
} CatCache; /* VARIABLE LENGTH STRUCT */
@@ -89,6 +95,7 @@ extern void AtEOXact_CatCache(bool isCommit);
extern CatCache *InitCatCache(int id, char *relname, char *indname,
int reloidattr,
int nkeys, int *key);
+extern void InitCatCachePhase2(CatCache *cache);
extern HeapTuple SearchCatCache(CatCache *cache,
Datum v1, Datum v2,