Re: Problem with index in OR'd expression

From: postgresql(dot)org(at)tgice(dot)com
To: pgsql-general(at)postgresql(dot)org
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: Problem with index in OR'd expression
Date: 2006-12-26 21:12:36
Message-ID: 45919044.3040008@tgice.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

postgresql(dot)org(at)tgice(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2006-12-26 21:54:50 Re: Problem with index in OR'd expression
Previous Message Tom Lane 2006-12-26 19:36:57 Re: Optimization of unnecessary GROUP BY columns