Re: [GENERAL] "Hash index" vs. "b-tree index" (PostgreSQL - Mailing list pgsql-performance

From Tom Lane
Subject Re: [GENERAL] "Hash index" vs. "b-tree index" (PostgreSQL
Date
Msg-id 25690.1115754605@sss.pgh.pa.us
Whole thread Raw
In response to Re: [GENERAL] "Hash index" vs. "b-tree index" (PostgreSQL  (Greg Stark <gsstark@mit.edu>)
Responses Re: [GENERAL] "Hash index" vs. "b-tree index" (PostgreSQL
List pgsql-performance
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

pgsql-performance by date:

Previous
From: "Mohan, Ross"
Date:
Subject: Prefetch - OffTopic
Next
From: Mischa Sandberg
Date:
Subject: Re: Partitioning / Clustering