Re: Proposal for Merge Join for Non '=' Operators

From: Hadi Moshayedi <hadi(at)moshayedi(dot)net>
To: Dilip kumar <dilip(dot)kumar(at)huawei(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Nicolas Barbier <nicolas(dot)barbier(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: Proposal for Merge Join for Non '=' Operators
Date: 2014-04-29 07:58:27
Message-ID: CAK=1=Wod_=tNGWSrZwbgvOYZLDK3ZWxG9nqmSQQz-y8470zY7w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello Dilip,

Query: select count(*) from t1,t2 where t1.b<t2.b and t1.b > 12000;
>
> Test Result:
> Nest Loop Join with Index Scan : 1653.506 ms
> Sort Merge Join for (seq scan) : 610.257ms
>
>
This looks like a great improvement. Repeating Nicolas's question, do you
have a real-world example of such joins?

In my experience, I see more queries like "self-join table A and table B
where A.time BETWEEN B.time - '1 week' and B.time", similar to
what Nicolas and Tom mentioned. As an example, "count users who placed an
order in the week following their registration".

Can you send a patch so we can also try it?

Thanks,
-- Hadi

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ashutosh Bapat 2014-04-29 08:55:32 using array of char pointers gives wrong results
Previous Message Heikki Linnakangas 2014-04-29 06:56:28 Re: includedir_internal headers are not self-contained