Short circuit evaluation of expressions in query

Поиск
Список
Период
Сортировка
От Jimmy Choi
Тема Short circuit evaluation of expressions in query
Дата
Msg-id 6E3775AF29598B46AA3F102067A510F101124BED@tor-ismsg01.altera.priv.altera.com
обсуждение исходный текст
Ответы Re: Short circuit evaluation of expressions in query  (Martijn van Oosterhout <kleptog@svana.org>)
Re: Short circuit evaluation of expressions in query  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general

Say I have the following parameterized query in a function:

 

select * from foo where ($1 = -1 or foo.status = $1) and (…)

 

where the (…) part consists of more parameterized conditions similar to the first one.

 

Suppose that at runtime, $1 is supplied a value of -1, does the foo.status = $1 condition still have to be evaluated?

 

Assuming the $1 = -1 case, should the above query be as fast as the following?

 

select * from foo where (…)

 

Thanks
Jimmy

 

 

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

Предыдущее
От: "Luis Alberto Pérez Paz"
Дата:
Сообщение: Re: How can I retrieve a function result?
Следующее
От: Qiao Yang
Дата:
Сообщение: MAX() across partition tables