mirror of
https://github.com/postgres/postgres.git
synced 2025-11-10 17:42:29 +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:
@@ -85,7 +85,7 @@ _hash_datum2hashkey(Relation rel, Datum key)
|
||||
Oid collation;
|
||||
|
||||
/* XXX assumes index has only one attribute */
|
||||
procinfo = index_getprocinfo(rel, 1, HASHPROC);
|
||||
procinfo = index_getprocinfo(rel, 1, HASHSTANDARD_PROC);
|
||||
collation = rel->rd_indcollation[0];
|
||||
|
||||
return DatumGetUInt32(FunctionCall1Coll(procinfo, collation, key));
|
||||
@@ -108,10 +108,10 @@ _hash_datum2hashkey_type(Relation rel, Datum key, Oid keytype)
|
||||
hash_proc = get_opfamily_proc(rel->rd_opfamily[0],
|
||||
keytype,
|
||||
keytype,
|
||||
HASHPROC);
|
||||
HASHSTANDARD_PROC);
|
||||
if (!RegProcedureIsValid(hash_proc))
|
||||
elog(ERROR, "missing support function %d(%u,%u) for index \"%s\"",
|
||||
HASHPROC, keytype, keytype,
|
||||
HASHSTANDARD_PROC, keytype, keytype,
|
||||
RelationGetRelationName(rel));
|
||||
collation = rel->rd_indcollation[0];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user