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

From Greg Stark
Subject Re: [PERFORM] "Hash index" vs. "b-tree index" (PostgreSQL
Date
Msg-id 878y2nsj7i.fsf@stark.xeocode.com
Whole thread Raw
In response to Re: [PERFORM] "Hash index" vs. "b-tree index" (PostgreSQL  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [PERFORM] "Hash index" vs. "b-tree index" (PostgreSQL
List pgsql-general
Tom Lane <tgl@sss.pgh.pa.us> writes:

> However: what about storing the things in hashcode order?  Ordering uint32s
> doesn't seem like any big conceptual problem.
>
> I think that efficient implementation of this would require explicitly
> storing the hash code for each index entry, which we don't do now, but
> it seems justifiable on multiple grounds --- besides this point, the
> search could avoid doing the data-type-specific comparison if the hash
> code isn't equal.

It seems that means doubling the size of the hash index. That's a pretty big
i/o to cpu tradeoff.

What if the hash index stored *only* the hash code? That could be useful for
indexing large datatypes that would otherwise create large indexes. A good
hash function should have a pretty low collision rate anyways so the
occasional extra i/o should more than be outweighed by the decrease in i/o
needed to use the index.

--
greg

pgsql-general by date:

Previous
From: Typing80wpm@aol.com
Date:
Subject: Re: Adventures in Quest for GUI RAD
Next
From: Frank Finner
Date:
Subject: Re: Need input on postgres used for phpBB