Re: Or selection on index versus union

From: Douglas McNaught <doug(at)mcnaught(dot)org>
To: han(dot)holl(at)informationslogik(dot)nl
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Or selection on index versus union
Date: 2005-10-05 12:11:05
Message-ID: m2u0fw17vq.fsf@Douglas-McNaughts-Powerbook.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

han(dot)holl(at)informationslogik(dot)nl writes:

> PS We still have to be careful how to formulate conditions:
>
> where fase in ('1','2')
>
> is ok, and uses the index, but the logically identical:
>
> where position(fase in '12') >= 1
>
> does a sequential scan.

Right, you would need a functional index to fix that. The query
optimizer, in general, doesn't know what specific functions
do--they're black boxes. So there would be no way for the optimizer
to figure out that the two expressions mean the same thing.

-Doug

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Markus Schulz 2005-10-05 12:44:52 Re: selfmade datatype in C and server-crash
Previous Message Neil Dugan 2005-10-05 11:49:06 Re: License question[VASCL:A1077160A86]