query plan and negative value (-1) in where clause [message #292258] |
Tue, 08 January 2008 05:25 |
maga
Messages: 17 Registered: November 2007
|
Junior Member |
|
|
I have a question about this query:
SELECT g.col1,
g.col2
FROM Tab1 g,
Tab2 Part
WHERE Part.col3 <> 0
AND g.col4 = 'PRO3'
AND g.col5 = Part.col5
AND g.Cod7 = - 1;
This is the execution plan:
SELECT STATEMENT, GOAL = ALL_ROWS
HASH JOIN
INDEX FAST FULL SCAN SYS_C00254422 (index of tab1)
TABLE ACCESS FULL TAB2
If I change the select in this way:
SELECT g.col1,
g.col2
FROM Tab1 g,
Tab2 Part
WHERE Part.col3 <> 0
AND g.col4 = 'PRO3'
AND g.col5 = Part.col5
AND - g.Cod7 = 1;
I have a new query plan:
SELECT STATEMENT, GOAL = ALL_ROWS
NESTED LOOPS
INDEX FAST FULL SCAN SYS_C00254422 (TAB1)
TABLE ACCESS BY INDEX ROWID TAB2
INDEX UNIQUE SCAN SYS_C00254336
Oracle use a nested loop and the index of the table TAB1 and doesn't do the hash join.
[Updated on: Tue, 08 January 2008 05:43] Report message to a moderator
|
|
|
|
|
|
|
|