logoalt Hacker News

pphyschyesterday at 8:23 PM2 repliesview on HN

Is the Hash Index method strictly superior to creating a unique "hash" column and precomputing the hash in the application or query?


Replies

ComputerGurutoday at 12:54 AM

Sibling comment mentions less space but also your alternative doesn’t (naively) handle supporting values that differ but hash to the same value.

Of course the hash index also outperforms a unique (btree) index on top of separately calculating the hash, in addition to the storage overhead, row bloat, lack of guarantees regarding the hash unless you expose it to Postgres as a user-defined function AND add a check constraint.

sirfzyesterday at 10:38 PM

It'll use less storage space