Re: Why hash indexes suck - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Why hash indexes suck
Date
Msg-id 12412.1086480954@sss.pgh.pa.us
Whole thread Raw
In response to Re: Why hash indexes suck  (Jeff Davis <jdavis-pgsql@empires.org>)
List pgsql-hackers
Jeff Davis <jdavis-pgsql@empires.org> writes:
> On Sat, 2004-06-05 at 13:31, Tom Lane wrote:
>> Only if you want to require a hash opclass to supply ordering operators,
>> which sort of defeats the purpose I think.  Hash is only supposed to
>> need equality not ordering.

> Is it possible to assume some kind of ordering (i.e. strcmp() the binary
> data of the type) as long as it's consistent?

Not really; that would assume that equality of the datatype is the same
as bitwise equality, which is not the case in general (consider -0
versus +0 in IEEE floats, or any datatype with pad bits in the struct).
Some time ago we got rid of the assumption that hash should hash on all
the bits without any type-specific intervention, and I don't want to
reintroduce those bugs.

We could safely sort on the hash value, but I'm not sure how effective
that would be, considering that we're talking about values that already
hashed into the same bucket --- there's likely not to be very many
distinct hash values there.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Jeff Davis
Date:
Subject: Re: Why hash indexes suck
Next
From: "Thomas Hallgren"
Date:
Subject: Re: Advice regarding configuration parameters