Re: plpgsql arrays

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Matthew Wakeling <matthew(at)flymine(dot)org>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: plpgsql arrays
Date: 2009-04-03 14:04:02
Message-ID: 28595.1238767442@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Matthew Wakeling <matthew(at)flymine(dot)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

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2009-04-03 14:08:35 Re: plpgsql arrays
Previous Message Matthew Wakeling 2009-04-03 13:57:12 Re: plpgsql arrays