Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Performance question - query with OR
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
![]() |
![]() |