diff options
| author | Tom Lane | 2000-02-21 03:36:59 +0000 |
|---|---|---|
| committer | Tom Lane | 2000-02-21 03:36:59 +0000 |
| commit | d8cedf67ad85799676c46f4c9f620fe4e91f71f8 (patch) | |
| tree | c511337416ca5d1ca7516ba5aaa9cd50b2204cad /src/include | |
| parent | a60c9e33e96a8f3694d94143d65ec6ee1fb3414b (diff) | |
Clean up some really grotty coding in catcache.c, improve hashing
performance in catcache lookups.
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/access/hash.h | 3 | ||||
| -rw-r--r-- | src/include/catalog/pg_proc.h | 6 | ||||
| -rw-r--r-- | src/include/catalog/pg_type.h | 11 | ||||
| -rw-r--r-- | src/include/utils/builtins.h | 4 | ||||
| -rw-r--r-- | src/include/utils/catcache.h | 8 | ||||
| -rw-r--r-- | src/include/utils/int8.h | 4 |
6 files changed, 16 insertions, 20 deletions
diff --git a/src/include/access/hash.h b/src/include/access/hash.h index c4aa369829..7b9445ec69 100644 --- a/src/include/access/hash.h +++ b/src/include/access/hash.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: hash.h,v 1.30 2000/01/26 05:57:50 momjian Exp $ + * $Id: hash.h,v 1.31 2000/02/21 03:36:51 tgl Exp $ * * NOTES * modeled after Margo Seltzer's hash implementation for unix. @@ -270,6 +270,7 @@ extern uint32 hashfloat4(float32 keyp); extern uint32 hashfloat8(float64 keyp); extern uint32 hashoid(Oid key); extern uint32 hashoidvector(Oid *key); +extern uint32 hashint2vector(int16 *key); extern uint32 hashchar(char key); extern uint32 hashtext(struct varlena * key); extern uint32 hashname(NameData *n); diff --git a/src/include/catalog/pg_proc.h b/src/include/catalog/pg_proc.h index 4fdbaaaf9d..56423e0c93 100644 --- a/src/include/catalog/pg_proc.h +++ b/src/include/catalog/pg_proc.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: pg_proc.h,v 1.123 2000/02/17 03:39:48 tgl Exp $ + * $Id: pg_proc.h,v 1.124 2000/02/21 03:36:55 tgl Exp $ * * NOTES * The script catalog/genbki.sh reads this file and generates .bki @@ -661,8 +661,8 @@ DATA(insert OID = 313 ( i2toi4 PGUID 11 f t t 1 f 23 "21" 100 0 0 100 i DESCR("convert int2 to int4"); DATA(insert OID = 314 ( i4toi2 PGUID 11 f t t 1 f 21 "23" 100 0 0 100 i4toi2 - )); DESCR("convert int4 to int2"); -DATA(insert OID = 315 ( keyfirsteq PGUID 11 f t f 2 f 16 "0 21" 100 0 0 100 keyfirsteq - )); -DESCR(""); +DATA(insert OID = 315 ( int2vectoreq PGUID 11 f t t 2 f 16 "22 22" 100 0 0 100 int2vectoreq - )); +DESCR("equal"); DATA(insert OID = 316 ( i4tod PGUID 11 f t t 1 f 701 "23" 100 0 0 100 i4tod - )); DESCR("convert int4 to float8"); DATA(insert OID = 317 ( dtoi4 PGUID 11 f t t 1 f 23 "701" 100 0 0 100 dtoi4 - )); diff --git a/src/include/catalog/pg_type.h b/src/include/catalog/pg_type.h index 83dd6e6dce..0a94265e5f 100644 --- a/src/include/catalog/pg_type.h +++ b/src/include/catalog/pg_type.h @@ -8,7 +8,7 @@ * Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: pg_type.h,v 1.82 2000/02/20 06:28:41 tgl Exp $ + * $Id: pg_type.h,v 1.83 2000/02/21 03:36:57 tgl Exp $ * * NOTES * the genbki.sh script reads this file and generates .bki @@ -177,13 +177,6 @@ DESCR("-32 thousand to 32 thousand, 2-byte storage"); DATA(insert OID = 22 ( int2vector PGUID INDEX_MAX_KEYS*2 -1 f b t \054 0 21 int2vectorin int2vectorout int2vectorin int2vectorout i _null_ )); DESCR("array of INDEX_MAX_KEYS int2 integers, used in system tables"); -/* - * XXX -- the implementation of int2vector's in postgres is a hack, and will - * go away someday. until that happens, there is a case (in the - * catalog cache management code) where we need to step gingerly - * over piles of int2vector's on the sidewalk. in order to do so, we - * need the OID of the int2vector row from pg_type. - */ #define INT2VECTOROID 22 DATA(insert OID = 23 ( int4 PGUID 4 10 t b t \054 0 0 int4in int4out int4in int4out i _null_ )); @@ -216,6 +209,8 @@ DESCR("command identifier type, sequence in transaction id"); DATA(insert OID = 30 ( oidvector PGUID INDEX_MAX_KEYS*4 -1 f b t \054 0 26 oidvectorin oidvectorout oidvectorin oidvectorout i _null_ )); DESCR("array of INDEX_MAX_KEYS oids, used in system tables"); +#define OIDVECTOROID 30 + DATA(insert OID = 32 ( SET PGUID -1 -1 f b t \054 0 0 textin textout textin textout i _null_ )); DESCR("set of tuples"); diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h index df8dad8dc3..b6e9cee499 100644 --- a/src/include/utils/builtins.h +++ b/src/include/utils/builtins.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: builtins.h,v 1.102 2000/02/16 17:26:25 thomas Exp $ + * $Id: builtins.h,v 1.103 2000/02/21 03:36:59 tgl Exp $ * * NOTES * This should normally only be included by fmgr.h. @@ -75,6 +75,7 @@ extern int32 int2in(char *num); extern char *int2out(int16 sh); extern int16 *int2vectorin(char *shs); extern char *int2vectorout(int16 *shs); +extern bool int2vectoreq(int16 *arg1, int16 *arg2); extern int32 *int44in(char *input_string); extern char *int44out(int32 *an_array); extern int32 int4in(char *num); @@ -109,7 +110,6 @@ extern bool int42lt(int32 arg1, int32 arg2); extern bool int42le(int32 arg1, int32 arg2); extern bool int42gt(int32 arg1, int32 arg2); extern bool int42ge(int32 arg1, int32 arg2); -extern bool keyfirsteq(int16 *arg1, int16 arg2); extern int32 int4um(int32 arg); extern int32 int4pl(int32 arg1, int32 arg2); extern int32 int4mi(int32 arg1, int32 arg2); diff --git a/src/include/utils/catcache.h b/src/include/utils/catcache.h index 58ef8d6cae..7b4b679e9d 100644 --- a/src/include/utils/catcache.h +++ b/src/include/utils/catcache.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: catcache.h,v 1.19 2000/01/26 05:58:37 momjian Exp $ + * $Id: catcache.h,v 1.20 2000/02/21 03:36:59 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -38,6 +38,8 @@ typedef struct catctup #define NCCBUCK 500 /* CatCache buckets */ #define MAXTUP 300 /* Maximum # of tuples cached per cache */ +typedef uint32 (* CCHashFunc) (Datum); + typedef struct catcache { Oid relationId; @@ -52,8 +54,8 @@ typedef struct catcache short cc_maxtup; /* max # of tuples allowed (LRU) */ short cc_nkeys; short cc_size; - short cc_key[4]; - short cc_klen[4]; + short cc_key[4]; /* AttrNumber of each key */ + CCHashFunc cc_hashfunc[4]; /* hash function to use for each key */ ScanKeyData cc_skey[4]; struct catcache *cc_next; Dllist *cc_lrulist; /* LRU list, most recent first */ diff --git a/src/include/utils/int8.h b/src/include/utils/int8.h index 1f3114dd7c..e4e4f04b19 100644 --- a/src/include/utils/int8.h +++ b/src/include/utils/int8.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: int8.h,v 1.17 2000/01/26 05:58:38 momjian Exp $ + * $Id: int8.h,v 1.18 2000/02/21 03:36:59 tgl Exp $ * * NOTES * These data types are supported on all 64-bit architectures, and may @@ -93,9 +93,7 @@ extern int64 *int48(int32 val); extern int32 int84(int64 *val); #ifdef NOT_USED -extern int64 *int2vector (int16 val); extern int16 int82(int64 *val); - #endif extern float64 i8tod(int64 *val); |
