Home > Blockchain >  How does postgres calculate multi column hashes?
How does postgres calculate multi column hashes?

Time:11-09

In PG I have a table which is using partition by hash (*text*, *bigint*) looking at a previous answer the functions used for hashing can be seen however I'm unsure which function is used to build combined hashes?

Is it treating the partition keys as a record and using hash_record?

Ultimately I want to know this to rebuild the hashing function in Java to optimise reads and writes to specific partitions.

CodePudding user response:

The hash_combine64 is used for calculating the ultimate hash value. According to the comments in the code it's based on the boost's hash_combine approach. Also, you can find the whole partition calculation algorithm in compute_partition_hash_value function.

  • Related