-
A SQL like this
select T1.column1 , ....
from T1
where T1.a not in
(select T2.b from T2 where ....)
The explain shows a full table scan on T2 . And I want to
use a hint to force a index range scan on T2 . How to write ?
Thanks for your time
-
Jackil
All you need to do is creating an index on t2.b and modify the where class to include t2.b = t1.a. This will ensure the usage of index on table T2.
Raj
-
In fact , it's not possible to convert "not in " to a "=" cause.
Anyway , I have successfully make these query using index on T2 . But what I want to know is just the syntax of
writing a hint in the nest select statement
thansk
-
what about:
select /*+INDEX(T2 T2_IDX) */
T1.column1 , ....
from
where T1.a not in
(select T2.b from T2 where ....)
-
Well, if you realy have an index on T2.b, then much more efficient way for your query would be:
select T1.column1 , ....
from T1
WHERE NOT EXISTS
(SELECT null FROM T2 WHERE T2.b=T1.a);
Jurij Modic
ASCII a stupid question, get a stupid ANSI
24 hours in a day .... 24 beer in a case .... coincidence?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|