Tuning for IN subquery
From: David Ball <dgb_at_ornl.gov>
Date: 2000/05/30
Message-ID: <3933B4B8.354DD9B1_at_ornl.gov>#1/1
Date: 2000/05/30
Message-ID: <3933B4B8.354DD9B1_at_ornl.gov>#1/1
[Quoted] [Quoted] The following query returns the results quickly:
SELECT * FROM VIEW1 WHERE KEY1 IN ('X1', 'X2', 'X3')
while this query is very slow:
SELECT * FROM VIEW1 WHERE KEY1 IN (SELECT KEY1 FROM TABLE1)
VIEW1 joins many tables by KEY1. These tables are indexed by KEY1.
TABLE1 has three rows with the same values for KEY1 as in the first
query. It is not indexed.
Is there a hint I can use to make the second query as fast as the first?
Thanks,
Dave Ball
Lockheed Martin
Received on Tue May 30 2000 - 00:00:00 CEST