From: | "Nicolas Barbier" <nicolas(dot)barbier(at)gmail(dot)com> |
---|---|
To: | Ottó Havasvölgyi <havasvolgyi(dot)otto(at)gmail(dot)com> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Eliminating unnecessary left joins |
Date: | 2007-04-20 21:02:52 |
Message-ID: | b0f3f5a10704201402ode108dkeeeef8c7989b26ee@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
2007/4/16, Ottó Havasvölgyi <havasvolgyi(dot)otto(at)gmail(dot)com>:
> Eliminate the table T from the query/subquery if the following requirements
> are satisfied:
> 1. T is left joined
> 2. T is referenced only in the join expression where it is left joined
> 3. the left join's join expression is a simple equality expression like
> T1.C1=T2.C2; T1!=T2 and (T==T1 or T==T2)
> 4. the column of T in the join exression is the primary key of T
Condition 4 should be: the column of T in the join expression is a key
of T (i.e. it doesn't need to be the PK, a UNIQUE constraint would be
enough).
This process can be done recursively (implementation doesn't have to
be recursive, of course), to eliminate whole sub-trees of the join
tree.
Nicolas
--
Nicolas Barbier
http://www.gnu.org/philosophy/no-word-attachments.html
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2007-04-20 21:47:15 | Re: 27 second plan times |
Previous Message | Gregory Stark | 2007-04-20 20:17:54 | 27 second plan times |