diff options
author | Bruce Momjian <bruce@momjian.us> | 2002-02-25 04:06:52 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2002-02-25 04:06:52 +0000 |
commit | f5dff44736911b10c83d2717ca53ad90dd967758 (patch) | |
tree | 6e4068345b5599efd5cab5b82cd66f531f676da0 /src/backend/utils/cache | |
parent | 7464e7f25ae56da1c4231c637b243a957431979b (diff) | |
download | postgresql-f5dff44736911b10c83d2717ca53ad90dd967758.tar.gz postgresql-f5dff44736911b10c83d2717ca53ad90dd967758.zip |
I've attached a simple patch which should improve the performance of
hashname() and reduce the penalty incured when NAMEDATALEN is increased.
I posted this to -hackers a couple days ago, and there haven't been any
major complaints. It passes the regression tests. See -hackers for more
discussion, as well as the suggestion from Tom Lane on which this patch
is based.
Unless anyone sees any problems, please apply for 7.3.
Cheers,
Neil Conway
Diffstat (limited to 'src/backend/utils/cache')
-rw-r--r-- | src/backend/utils/cache/catcache.c | 22 |
1 files changed, 2 insertions, 20 deletions
diff --git a/src/backend/utils/cache/catcache.c b/src/backend/utils/cache/catcache.c index 47ab410cfc2..4339f51f3d7 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.87 2002/02/19 20:11:17 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.88 2002/02/25 04:06:50 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -97,7 +97,6 @@ static Index CatalogCacheComputeHashIndex(CatCache *cache, static Index CatalogCacheComputeTupleHashIndex(CatCache *cache, HeapTuple tuple); static void CatalogCacheInitializeCache(CatCache *cache); -static Datum cc_hashname(PG_FUNCTION_ARGS); #ifdef CATCACHE_STATS static void CatCachePrintStats(void); #endif @@ -116,7 +115,7 @@ GetCCHashFunc(Oid keytype) case CHAROID: return hashchar; case NAMEOID: - return cc_hashname; + return hashname; case INT2OID: return hashint2; case INT2VECTOROID: @@ -137,23 +136,6 @@ GetCCHashFunc(Oid keytype) } } -static Datum -cc_hashname(PG_FUNCTION_ARGS) -{ - /* - * We need our own variant of hashname because we want to accept - * null-terminated C strings as search values for name fields. So, we - * have to make sure the data is correctly padded before we compute - * the hash value. - */ - NameData my_n; - - namestrcpy(&my_n, NameStr(*PG_GETARG_NAME(0))); - - return DirectFunctionCall1(hashname, NameGetDatum(&my_n)); -} - - #ifdef CATCACHE_STATS static void |