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 -> Messy SQL performance question (NOT in SELECT clause)

Messy SQL performance question (NOT in SELECT clause)

From: <cmohan_at_iname.com>
Date: Fri, 17 Apr 1998 14:16:25 -0600
Message-ID: <6h89q6$nid$1@nnrp1.dejanews.com>


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

Original text of this message

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