Re: Does FILTER in SEQSCAN short-circuit AND?

Поиск
Список
Период
Сортировка
От Kevin Grittner
Тема Re: Does FILTER in SEQSCAN short-circuit AND?
Дата
Msg-id 4BFE8F4F0200002500031BA2@gw.wicourts.gov
обсуждение исходный текст
Ответ на Does FILTER in SEQSCAN short-circuit AND?  ("Carlo Stonebanks" <stonec.register@sympatico.ca>)
Ответы Performance costs of various PL languages  ("Carlo Stonebanks" <stonec.register@sympatico.ca>)
Список pgsql-performance
"Carlo Stonebanks" <stonec.register@sympatico.ca> wrote:

> SELECT *
> FROM MyTable
> WHERE foo = 'bar' AND MySlowFunc('foo') = 'bar'
>
> Let's say this required a SEQSCAN because there were no indexes to
> support column foo. For every row where foo <> 'bar' would the
> filter on the SEQSCAN short-circuit the AND return false right
> away, or would it still execute MySlowFunc('foo') ?

For that example, I'm pretty sure it will skip the slow function for
rows which fail the first test.  A quick test confirmed that for me.
If you create a sufficiently slow function, you shouldn't have much
trouble testing that yourself.  :-)

-Kevin

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

Предыдущее
От: "Carlo Stonebanks"
Дата:
Сообщение: Does FILTER in SEQSCAN short-circuit AND?
Следующее
От: Craig James
Дата:
Сообщение: Re: Does FILTER in SEQSCAN short-circuit AND?