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: Dan Rippel <jford_at_mail.erols.com>
Date: 1997/02/13
Message-ID: <3302961e.8161119@news.erols.com>#1/1

Try to use IN in place of OR
On Tue, 11 Feb 1997 17:36:32 -0800, alantai <alantai_at_multiactive.com> 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
Received on Thu Feb 13 1997 - 00:00:00 CST

Original text of this message

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