1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-02 09:02:37 +03:00

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
This commit is contained in:
Bruce Momjian
2002-02-25 04:06:52 +00:00
parent 7464e7f25a
commit f5dff44736
3 changed files with 8 additions and 26 deletions

View File

@ -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