Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Messy SQL performance question (NOT in SELECT clause)
1.
SELECT /*+ INDEX primary-index */
column-names from table-name where PRIMARY-KEY = :value"
2.
SELECT /*+ INDEX secondary-index */
column-names from table-name where SECONDARY-KEY = : value2
AND
PRIMARY-KEY NOT IN (SELECT PRIMARY-KEY from table-name
where PRIMARY-KEY = :value)
In query 2, the subquery will use the index, as well as the main query. Finally, the two result sets will be merged, hence eliminating tablescan.
Good luck,
cm
-----== Posted via Deja News, The Leader in Internet Discussion ==----- http://www.dejanews.com/ Now offering spam-free web-based newsreading Received on Fri Apr 17 1998 - 15:16:25 CDT
![]() |
![]() |