Re: do unneeded outer joins cost?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: do unneeded outer joins cost?
Дата
Msg-id 4694.1244215537@sss.pgh.pa.us
обсуждение исходный текст
Ответ на do unneeded outer joins cost?  (chester c young <chestercyoung@yahoo.com>)
Список pgsql-sql
chester c young <chestercyoung@yahoo.com> writes:
> for example:

> select    t1.*
> from      t1
> left join t2 on( <expensive condition> );

> since t2 is not used in the result nor is it used in determining the result, is the <expensive condition> to left
joint2 used?
 

It's not correct that the t2 join is irrelevant to the result.  If any
row of t1 joins to more than one row of t2 then the join would affect
the result.

In some cases it is possible to prove that no row of t1 can join to more
than one row of t2, in which case the join to t2 could be dropped.
Postgres does not currently implement such an optimization (although
I believe someone is working on it for 8.5).  It seems likely though
that an "expensive" join condition would be too complex to be amenable
to such a proof anyway.
        regards, tom lane


В списке pgsql-sql по дате отправления:

Предыдущее
От: Gianvito Pio
Дата:
Сообщение: Re: Type inheritance
Следующее
От: Rob Sargent
Дата:
Сообщение: Re: Type inheritance