Subject Not sure why join speed is slow
Author Louis van Alphen

I have a query as follows:

 

with A as

(

  <some sql>

  <my own plan>

),

B as

(

  <some sql>

),

C as

(

  select *

  from B

  left outer join A on A.SOME_ID = B.SOME_ID

)

select * from C

 

When I execute the sql for A without my own plan, the result takes 140ms. With my own plan the result takes 90ms. The resulting rowcount is 6

 

When I execute sql for B, execute time is shown as 0ms with rowcount 8

 

When I execute the entire query, the resulting rowcount is correctly 8 but the query result takes around 500ms. I don’t understand why joining 6 rows onto 8 takes so much more time?

 

Would appreciate help

 

Louis