HACKER Q&A
📣 ritchie46

Which hash function for join algorithms


I am implementing join algorithms and used FNV hash. Before doing any benchmarks I wonder is there a defacto standard hash function to use for join algs? Does anybody know what Postgres uses for instance?


  👤 brudgers Accepted Answer ✓
The fastest algorithm will depend on the nature of the data. So Postgres maintains statistics, allows indexes, and uses a query optimizer to find an "unterrible" approach. The measure of terribleness is IO.

Or to put it another way, there isn't a silver bullet method based on theory. In practice it is always one of a kind for the job in hand. That's why database tuning is a thing.

Good luck.