Re: Better management of mergejoinable operators

From: Andrew - Supernews <andrew+nonews(at)supernews(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Better management of mergejoinable operators
Date: 2006-12-13 06:47:13
Message-ID: slrnenv8fh.1aj7.andrew+nonews@atlantis.supernews.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2006-12-13, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Andrew - Supernews <andrew+nonews(at)supernews(dot)com> writes:
>> On 2006-12-13, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>> BTW, I think it's possible to prove that there need never be two for the
>>> case of both sides the same datatype.
>
>> Counterexample even for a single data type: define an operator x =* y
>> which is true when 2x = y. This is mergejoinable using the following
>> operators: SORT1 = <, SORT2 = <, LTCMP = (2x < y), RTCMP = (2x > y)
>> (which is of course the same sortops as for regular =).
>
> I think not --- the corresponding sort operators would have to be
> "2x < y" etc, else the trichotomy law fails, and so do all standard
> sort algorithms.

No, because if x < x' then 2x < 2x'. Or to put it another way, doing
a merge join on (2x = y) simply requires matching the sorted lists of
x's and y's against each other in a different place, rather than changing
the sort order of either.

You're suffering from a fundamental confusion between the ltcmp/rtcmp
operators (which indeed must be trichotomous with the join operator)
and the sort operators.

--
Andrew, Supernews
http://www.supernews.com - individual and corporate NNTP services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message edwinoneel 2006-12-13 07:36:44 libpq.a in a universal binary
Previous Message Jim C. Nasby 2006-12-13 06:32:43 Re: Load distributed checkpoint