Re: Optimizer refuses to hash join - Mailing list pgsql-performance

From Tom Lane
Subject Re: Optimizer refuses to hash join
Date
Msg-id 24077.1091206170@sss.pgh.pa.us
Whole thread Raw
In response to Optimizer refuses to hash join  (Stan Bielski <bielski@ece.cmu.edu>)
List pgsql-performance
Stan Bielski <bielski@ece.cmu.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

pgsql-performance by date:

Previous
From: "Scott Marlowe"
Date:
Subject: Re: my boss want to migrate to ORACLE
Next
From: "Matthew T. O'Connor"
Date:
Subject: Re: my boss want to migrate to ORACLE