mirror of
https://github.com/postgres/postgres.git
synced 2025-07-03 20:02:46 +03:00
Introduce 64-bit hash functions with a 64-bit seed.
This will be useful for hash partitioning, which needs a way to seed the hash functions to avoid problems such as a hash index on a hash partitioned table clumping all values into a small portion of the bucket space; it's also useful for anything that wants a 64-bit hash value rather than a 32-bit hash value. Just in case somebody wants a 64-bit hash value that is compatible with the existing 32-bit hash values, make the low 32-bits of the 64-bit hash value match the 32-bit hash value when the seed is 0. Robert Haas and Amul Sul Discussion: http://postgr.es/m/CA+Tgmoafx2yoJuhCQQOL5CocEi-w_uG4S2xT0EtgiJnPGcHW3g@mail.gmail.com
This commit is contained in:
8
src/backend/utils/cache/lsyscache.c
vendored
8
src/backend/utils/cache/lsyscache.c
vendored
@ -490,8 +490,8 @@ get_compatible_hash_operators(Oid opno,
|
||||
|
||||
/*
|
||||
* get_op_hash_functions
|
||||
* Get the OID(s) of hash support function(s) compatible with the given
|
||||
* operator, operating on its LHS and/or RHS datatype as required.
|
||||
* Get the OID(s) of the standard hash support function(s) compatible with
|
||||
* the given operator, operating on its LHS and/or RHS datatype as required.
|
||||
*
|
||||
* A function for the LHS type is sought and returned into *lhs_procno if
|
||||
* lhs_procno isn't NULL. Similarly, a function for the RHS type is sought
|
||||
@ -542,7 +542,7 @@ get_op_hash_functions(Oid opno,
|
||||
*lhs_procno = get_opfamily_proc(aform->amopfamily,
|
||||
aform->amoplefttype,
|
||||
aform->amoplefttype,
|
||||
HASHPROC);
|
||||
HASHSTANDARD_PROC);
|
||||
if (!OidIsValid(*lhs_procno))
|
||||
continue;
|
||||
/* Matching LHS found, done if caller doesn't want RHS */
|
||||
@ -564,7 +564,7 @@ get_op_hash_functions(Oid opno,
|
||||
*rhs_procno = get_opfamily_proc(aform->amopfamily,
|
||||
aform->amoprighttype,
|
||||
aform->amoprighttype,
|
||||
HASHPROC);
|
||||
HASHSTANDARD_PROC);
|
||||
if (!OidIsValid(*rhs_procno))
|
||||
{
|
||||
/* Forget any LHS function from this opfamily */
|
||||
|
Reference in New Issue
Block a user