Tuning SQL Tree walk as a subselect in a where clause.
I have a query with a subselect that is a tree walk.
If I view a simple subselect like select * from my_table where journaltime=(select max(journaltime) from mytable) its my understanding that the sub select is fired first and the result used in the outer query to return the max row.
My query now has
select ......... from a,b,c,d LEFT OUTER JOIN oN (for all join conditions)
where col_id =8888888888888888 or col_id in ( select col_id from ..... connect by prior ...start with....etc
The optimizer merges these queries (as it should you say) but the result is that it creates a huge results set the uses the subquery as a filter to return 2 rows. This results in approx