From: | Hannu Krosing <hannu(at)2ndQuadrant(dot)com> |
---|---|
To: | Atri Sharma <atri(dot)jiit(at)gmail(dot)com> |
Cc: | Antonin Houska <antonin(dot)houska(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Removing Inner Joins |
Date: | 2013-07-10 07:41:38 |
Message-ID: | 51DD1032.8060603@2ndQuadrant.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 07/10/2013 09:18 AM, Atri Sharma wrote:
>> Can you please post an example of such a join removal? I mean a query before
>> and after the removal. Thanks,
> Courtesy Robert Haas:
>
> SELECT foo.x, foo.y, foo.z FROM foo WHERE foo.x = bar.x
>
> Conditions:
>
> 1) foo.x is not null.
I guess that this is also not needed. you can just remove rows where
foo.x is null
That is, replace the join with "foo.x is not null"
>
> 2) foo (x) is a foreign key referencing bar (x).
>
> We can ignore bar completely in this case i.e. avoid scanning bar.
>
> Regards,
>
> Atri
>
>
> --
> Regards,
>
> Atri
> l'apprenant
>
>
--
Hannu Krosing
PostgreSQL Consultant
Performance, Scalability and High Availability
2ndQuadrant Nordic OÜ
From | Date | Subject | |
---|---|---|---|
Next Message | ivan babrou | 2013-07-10 07:49:31 | Re: Millisecond-precision connect_timeout for libpq |
Previous Message | Atri Sharma | 2013-07-10 07:18:54 | Re: Removing Inner Joins |