Greg Stark <gsstark@mit.edu> writes:
>>> What if the hash index stored *only* the hash code? That could be useful for
>>> indexing large datatypes that would otherwise create large indexes.
>>
>> Hmm, that could be a thought.
> Hm, if you go this route of having hash indexes store tuples ordered by hash
> code and storing the hash code in the index, then it seems hash indexes become
> just a macro for a btree index of HASH(index columns).
No, not at all, because searching such an index will require a tree
descent, thus negating the one true advantage of hash indexes. I see
the potential value of sorting by hashcode within an individual page,
but that doesn't mean we should do the same across the whole index.
regards, tom lane