when you "inner join" a table, you should put all the conditions for that table into that join.
putting it into the where clause will just make the optimizer doing more work than necessary, and eventually not finding the good execution plan.
the next things are to look at the exection plan as you move the conditions. does it actually change?
then, check out for indexes. note that OR conditions are difficult to get "indexed", except for large queries with bitmap indexes eventually (where you have to know what you are doing).
TO_NUMBER(v1."Value")=3.0
requires a function-based index ...
Main Topics
Browse All Topics





by: schwertnerPosted on 2008-08-04 at 00:43:38ID: 22150554
You use SQL99 syntax.
Join condition is normally part of the WHERE clause.
It is a hard task to command the optimizer how to do the query.
One way to achive this is to use views or inline views (selects in the FROM clause).
This has the advantage that you will insist thejpin be done first
and only after that to restrict the result in the where clause.
SELECT some_columns
FROM (select ... from ... where ...join here)
WHERE .. .restrict the join here
ORDER BY .... ;