mirror of
https://github.com/postgres/postgres.git
synced 2025-11-06 07:49:08 +03:00
Improve speed of hash index build.
In the initial data sort, if the bucket numbers are the same then next sort on the hash value. Because index pages are kept in hash value order, this gains a little speed by allowing the eventual tuple insertions to be done sequentially, avoiding repeated data movement within PageAddItem. This seems to be good for overall speedup of 5%-9%, depending on the incoming data. Simon Riggs, reviewed by Amit Kapila Discussion: https://postgr.es/m/CANbhV-FG-1ZNMBuwhUF7AxxJz3u5137dYL-o6hchK1V_dMw86g@mail.gmail.com
This commit is contained in:
@@ -42,9 +42,10 @@ struct HSpool
|
||||
Relation index;
|
||||
|
||||
/*
|
||||
* We sort the hash keys based on the buckets they belong to. Below masks
|
||||
* are used in _hash_hashkey2bucket to determine the bucket of given hash
|
||||
* key.
|
||||
* We sort the hash keys based on the buckets they belong to, then by the
|
||||
* hash values themselves, to optimize insertions onto hash pages. The
|
||||
* masks below are used in _hash_hashkey2bucket to determine the bucket of
|
||||
* a given hash key.
|
||||
*/
|
||||
uint32 high_mask;
|
||||
uint32 low_mask;
|
||||
|
||||
Reference in New Issue
Block a user