Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Q: query with OR

Re: Q: query with OR

From: John P. Higgins <jh33378_at_deere.com>
Date: 1997/02/12
Message-ID: <33024975.3432@deere.com>#1/1

alantai wrote:
>
> Senario:
> 1.Get the record count for a search returning less than 100000
> records.
> 2.The table is indexed on fieldone.
> 3.Explain Plan shows that the following queries use the index.
>
> query1: SELECT COUNT(*) FROM tablename
> WHERE fieldone='valueone' and ROWNUM <100000;
>
> query2: SELECT COUNT(*) FROM tablename
> WHERE (fieldone='value1' OR fieldone='value2')
> AND ROWNUM < 100000;
>
> The first query returns very fast, but the second one takes very long.
> Is there any way to speed up the second query?
> Please email to me directly at alantai_at_multiactive.com.
>
> Thanks in advance.
>
> Alan


'OR' in the where clause kills the use of indexes! Received on Wed Feb 12 1997 - 00:00:00 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US