Re: Why hash indexes suck

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jeff Davis <jdavis-pgsql(at)empires(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Why hash indexes suck
Date: 2004-06-06 00:15:54
Message-ID: 12412.1086480954@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Jeff Davis <jdavis-pgsql(at)empires(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Peter Eisentraut 2004-06-06 01:06:34 Re: PostgreSQL certifications?
Previous Message Adrian Klaver 2004-06-05 23:32:03 Re: How can I delete a primary or foreign key?

Browse pgsql-hackers by date

  From Date Subject
Next Message Marc G. Fournier 2004-06-06 01:29:49 Re: Official Freeze Date for 7.5: July 1st, 2004
Previous Message Jeff Davis 2004-06-05 22:30:34 Re: Why hash indexes suck