Re: Eliminating unnecessary left joins
От
Ottó Havasvölgyi
Тема
Re: Eliminating unnecessary left joins
Дата
Msg-id
34608c0c0704210155h32cf6c56h3411c86c0b5d8737@mail.gmail.com
Ответ на
Re: Eliminating unnecessary left joins (Nicolas Barbier)
Список
Дерево обсуждения
Re: Eliminating unnecessary left joins "Robert Haas" <Robert.Haas@dyntek.com>
Re: Eliminating unnecessary left joins "Zeugswetter Andreas ADI SD" <ZeugswetterA@spardat.at>
Re: Eliminating unnecessary left joins "Ottó Havasvölgyi" <havasvolgyi.otto@gmail.com>
Re: Eliminating unnecessary left joins "Nicolas Barbier" <nicolas.barbier@gmail.com>
Re: Eliminating unnecessary left joins "Ottó Havasvölgyi" <havasvolgyi.otto@gmail.com>
But then what about the null values? Perhaps unique + notnull is better?
Otto
2007/4/20, Nicolas Barbier <nicolas.barbier@gmail.com>:
2007/4/16, Ottó Havasvölgyi <havasvolgyi.otto@gmail.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
В списке pgsql-hackers по дате отправления