"NOT IN" REPLACE WITH "MINUS" [message #523041] |
Thu, 15 September 2011 06:28 |
|
thinknightgmailcom
Messages: 1 Registered: September 2011
|
Junior Member |
|
|
I have 2 questions for this SQL Statement for tuning?
select * from a where id not in (select a_id from b)
1- How do i change this query with A MINUS OPERATOR
2- Shall i use a Hint for this query?
Explain plan is:
Execution Plan
--------------------------------------------------------------------------------
Plan hash value: 31652112322
--------------------------------------------------------------------------------
-
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time
|
--------------------------------------------------------------------------------
-
| 0 | SELECT STATEMENT | | 299 | 21528 | 9 (12)| 00:00:01
|
|* 1 | HASH JOIN RIGHT ANTI| | 299 | 21528 | 9 (12)| 00:00:01
|
|* 2 | TABLE ACCESS FULL | b | 1 | 23 | 4 (0)| 00:00:01
|
| 3 | TABLE ACCESS FULL | a | 300 | 14700 | 4 (0)| 00:00:01
|
--------------------------------------------------------------------------------
-
How do i optimize it best?
|
|
|
|