Re: Optimizer refuses to hash join

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Stan Bielski <bielski(at)ece(dot)cmu(dot)edu>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Optimizer refuses to hash join
Date: 2004-07-30 16:49:30
Message-ID: 24077.1091206170@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Stan Bielski <bielski(at)ece(dot)cmu(dot)edu> writes:
> On Thu, 29 Jul 2004, Tom Lane wrote:
>> Are you sure the join condition is hashjoinable? You didn't say
>> anything about the datatypes involved ...

> My apologies. The columns that I want to join are both type 'inet'.
> Shouldn't that be hashjoinable?

Depends on your PG version. The raw type isn't hashjoinable, because
its '=' operator ignores the inet-vs-cidr flag. Before 7.4 the operator
was (correctly) marked not hashjoinable. In 7.4 it was (incorrectly)
marked hashjoinable, due no doubt to momentary brain fade on my part.
For 7.5 it is hashjoinable and the join will actually work, because we
added a specialized hash function that also ignores the inet-vs-cidr flag.

If you are joining data that is all inet or all cidr (no mixtures),
then 7.4 works okay, which is why we didn't notice the bug right away.
If that's good enough for now, you could emulate the 7.4 behavior in
earlier releases by setting the oprcanhash flag in pg_operator for the
inet equality operator.

regards, tom lane

Browse pgsql-performance by date

  From Date Subject
Next Message Matthew T. O'Connor 2004-07-30 17:56:16 Re: my boss want to migrate to ORACLE
Previous Message Scott Marlowe 2004-07-30 15:14:51 Re: my boss want to migrate to ORACLE