| From: | Ragnar <gnari(at)hive(dot)is> | 
|---|---|
| To: | postgresql(dot)org(at)tgice(dot)com | 
| Cc: | pgsql-general(at)postgresql(dot)org | 
| Subject: | Re: Problem with index in OR'd expression | 
| Date: | 2006-12-27 17:27:50 | 
| Message-ID: | 1167240470.6369.328.camel@localhost.localdomain | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-general | 
On mið, 2006-12-27 at 11:02 -0600, postgresql(dot)org(at)tgice(dot)com wrote:
> 
> I was referring to the situation where one has this in a WHERE clause:
> 
>    ((vConstant IS NULL) OR (Table.IndexedCol = vConstant))
> 
> where vConstant is a *constant* parameter in a pl/pgsql function.
Reguardless of the issue whether pl/pgsql could be expected to
optimize this case, I find it difficult to imagine a scenario
where this kind of coding makes sense.
I understand that in some cases on would like to do this with
a *variable* to simplify logic, but what possible gain can
be had from doing this with a constant, other that obfuscation?
It does not make sense to spend CPU-time on  optimizing a case
that is not useful or common.
gnari
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2006-12-27 17:45:10 | Re: Problem with index in OR'd expression | 
| Previous Message | A. Kretschmer | 2006-12-27 17:03:29 | Re: Is PostgreSQL for this? |