mirror of
https://github.com/postgres/postgres.git
synced 2025-10-28 11:55:03 +03:00
Fix several hash functions that were taking chintzy shortcuts instead of
delivering a well-randomized hash value. I got religion on this after observing that performance of multi-batch hash join degrades terribly if the higher-order bits of hash values aren't random, as indeed was true for say hashes of small integer values. It's now expected and documented that hash functions should use hash_any or some comparable method to ensure that all bits of their output are about equally random. initdb forced because this change invalidates existing hash indexes. For the same reason, this isn't back-patchable; the hash join performance problem will get a band-aid fix in the back branches.
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/include/access/hash.h,v 1.81 2007/05/30 20:12:02 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/include/access/hash.h,v 1.82 2007/06/01 15:33:18 tgl Exp $
|
||||
*
|
||||
* NOTES
|
||||
* modeled after Margo Seltzer's hash implementation for unix.
|
||||
@@ -265,6 +265,7 @@ extern Datum hashname(PG_FUNCTION_ARGS);
|
||||
extern Datum hashtext(PG_FUNCTION_ARGS);
|
||||
extern Datum hashvarlena(PG_FUNCTION_ARGS);
|
||||
extern Datum hash_any(register const unsigned char *k, register int keylen);
|
||||
extern Datum hash_uint32(uint32 k);
|
||||
|
||||
/* private routines */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user