Re: Problem with index in OR'd expression

Поиск
Список
Период
Сортировка
От postgresql.org@tgice.com
Тема Re: Problem with index in OR'd expression
Дата
Msg-id 45919044.3040008@tgice.com
обсуждение исходный текст
Ответ на Re: Problem with index in OR'd expression  (postgresql.org@tgice.com)
Ответы Re: Problem with index in OR'd expression  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
postgresql.org@tgice.com wrote:
> Tom Lane wrote:
>> you're still gonna lose because those are variables not constants ...
>
> Well, that *is* what I'm hoping to do.  I understand how (0 IS NULL) is
> different from (variable IS NULL), but isn't it reasonable to expect
> that PG could evaluate that expression only once (knowing that the
> variable couldn't change during the course of the query execution) and
> then treat that expression as constant?

Also, I should mention that in my case, the "variables" are actually
constants either defined in the function param list (and thus
non-modifiable within the function body) or defined with:

   DECLARE vC1 CONSTANT varchar(10) := 'blah'

-type syntax.  I would submit that in that situation, it would be
reasonable for a user to expect my suggested syntax to still use the
indicated indexes.

Do you agree?  It it possible that something other than picking up the
'IS NULL' boolean as constant has changed between 8.0.x & 8.2 that might
make this work?

Thanks,

jl

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Optimization of unnecessary GROUP BY columns
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Problem with index in OR'd expression