Re: plpgsql arrays - Mailing list pgsql-performance

From Tom Lane
Subject Re: plpgsql arrays
Date
Msg-id 28595.1238767442@sss.pgh.pa.us
Whole thread Raw
In response to Re: plpgsql arrays  (Matthew Wakeling <matthew@flymine.org>)
Responses Re: plpgsql arrays  (Matthew Wakeling <matthew@flymine.org>)
Re: plpgsql arrays  (Simon Riggs <simon@2ndQuadrant.com>)
List pgsql-performance
Matthew Wakeling <matthew@flymine.org> writes:
> On Fri, 3 Apr 2009, Robert Haas wrote:
>> Why not just use SQL to do the join?

> Because the merge condition is:

> WHERE l1.start <= l2.end AND l2.start <= l1.end

> and merge joins in postgres only currently cope with the case where the
> merge condition is an equals relationship.

> Oh, hang on, I think I saw something in the docs about what conditions can
> be used in a merge...

No, you got it right the first time.  I was about to suggest that maybe
you could make it work by recasting the problem as equality on an
interval datatype, but the problem is that this is not equality but
"overlaps".  And you can't cheat and call it equality, because it's
not transitive.

I don't actually believe that a standard merge join algorithm will work
with an intransitive join condition ...

            regards, tom lane

pgsql-performance by date:

Previous
From: Matthew Wakeling
Date:
Subject: Re: plpgsql arrays
Next
From: Tom Lane
Date:
Subject: Re: plpgsql arrays