Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Q: query with OR
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 Tue Feb 11 1997 - 00:00:00 CST