Re: Expression transformation curiosity

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: Expression transformation curiosity
Дата
Msg-id 200308171801.23667.dev@archonet.com
обсуждение исходный текст
Ответ на Re: Expression transformation curiosity  ("Alexander M. Pravking" <fduch@antar.bryansk.ru>)
Список pgsql-sql
On Sunday 17 August 2003 16:39, Alexander M. Pravking wrote:
> On Sun, Aug 17, 2003 at 11:32:58AM +0100, Richard Huxton wrote:
> > Boiling the problem down, I've looked at a clause of the form:
> >   a OR (b AND c)
> > which PG converts to:
> >   (a OR b) AND (a OR c)

> > Is it an artefact of displaying the EXPLAIN, or is it actually processed
> > that way? You could see how testing "a" twice could be expensive in some
> > situations.
>
> Looks like it actually works this way.
> I had the same problem several weeks ago on 7.3.3 with 4 such OR's.
> The final filter became monsterous, and the query was very slow.
>
> I've simply rewritten the query using UNION, and it became much faster.

Doesn't seem to matter much in this case, although I tried it as a UNION just 
to check the results were the same.

Thanks Alexander
--  Richard Huxton Archonet Ltd


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

Предыдущее
От: "Alexander M. Pravking"
Дата:
Сообщение: Re: Expression transformation curiosity
Следующее
От: "Moonstruck"
Дата:
Сообщение: Reverse pattern match.