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

Home -> Community -> Usenet -> c.d.o.misc -> Performance question - query with OR

Performance question - query with OR

From: KenParis <KenParis_at_prodigy.net>
Date: 9 Apr 1998 20:21:50 GMT
Message-ID: <01bd63f5$29333100$0c549cd1@kenp0007>


I need help on Oracle performance. I don't have direct access to Oracle - it's all being done by a remote associate.

We are executing a query of the form:

SELECT 	columns
FROM	  	table

WHERE	(column_1	=	value1
     AND		 column_2	=	value2
     AND		 column_3	=	value3)

OR		(column_1	=	value1
     AND		 column_2	>	value2)

OR		(column_1	>	value1)

ORDER BY	column_1, column_2, column_3

Even though we have an index on column_1, column_2 and column_3, Oracle still
does a sort (I'm told it doesn't like the OR). We tried rewriting this using the more
complicated but equivalent version replacing the ORs with AND NOTs (among other
changes), but this was worse.

Any suggestions on how to deal with queries of this form (this solves the general problem
of seeing a set of columns in order and wanting to get the next set of values after those
with values: value1, value2 and value3).

For instance, does Oracle support a WHERE clause of the form:

        WHERE column_1, column_2, column_3 > value1, value2, value3 ? Received on Thu Apr 09 1998 - 15:21:50 CDT

Original text of this message

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