Skip to Main Content
  • Questions
  • WITH's work, but join on WITH's runs forever. Is there a way to force WITH tables to fully materialize perhaps?

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, jimbo.

Asked: February 08, 2017 - 7:42 pm UTC

Last updated: February 09, 2017 - 6:26 pm UTC

Version: 12.9

Viewed 1000+ times

You Asked

with
a as (),
b as (),
c as (),
d as ()

select count(*) from a
138

select count(*) from c
138

select * from a left join c on a.val=c.val
-this never finishes, runs forever

Is there a way to add a hint to force it to work? My 2 experts here spent 2 hours on this with no solution, so I thought Ask-Tom would enlighten ;-)



and Connor said...

with 
A as
  ( select /*+ materialize */ ... from  ),
B as
  ( select /*+ materialize */ ... from  ),
C as
  ( select /*+ materialize */ ... from  ),
select * from ...



might help, but I would also spend some time looking at why the optimizer is getting it wrong without the assistance.

Is this answer out of date? If it is, please let us know via a Comment

More to Explore

Performance

Get all the information about database performance in the Database Performance guide.