Re: - Slow Query

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: - Slow Query
Дата
Msg-id 14166.1246471635@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: - Slow Query  (Scott Marlowe <scott.marlowe@gmail.com>)
Список pgsql-performance
Scott Marlowe <scott.marlowe@gmail.com> writes:
> On Wed, Jul 1, 2009 at 11:52 AM, Tom Lane<tgl@sss.pgh.pa.us> wrote:
>> Scott Marlowe <scott.marlowe@gmail.com> writes:
>>> Sometimes putting a where clause portion into the on clause helps.
>>> like:
>>> select * from a left join b on (a.id=b.id) where a.somefield=2
>>> might run faster with
>>> select * from a left join b on (a.id=bid. and a.somefield=2);
>>> but it's hard to say.
>>
>> Uh, those are not the same query ... they will give different results
>> for rows with a.somefield different from 2.

> How so?  Neither should return any rows with a.somefield <> 2.

Wrong.  The second will return rows with somefield <> 2, null-extended
(whether or not there is any match on id).

            regards, tom lane

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

Предыдущее
От: Scott Marlowe
Дата:
Сообщение: Re: - Slow Query
Следующее
От: Sergey Burladyan
Дата:
Сообщение: regression ? 8.4 do not apply One-Time Filter to subquery