Table a is the main table Tables b and c are related thru the rsn field in table a. Table c has a self referencing column called parent_rsn. This query works but is very slow when table c has lots of rows (100,000s). select a.rsn,b.col1,b.col2,c.col3 from a join b on a.rsn = b.a_rsn join c on a.rsn = c.a_rsn where a.col4 = 'foo' and b.col5 = 'bar' and c.col9 = 'bla' and c.rsn in ( with r (rsn) as ( select rsn from c where c.col6 = 1234 union all select rs.rsn from c r2,r where r2.parent_rsn = r.rsn ) select * from r ) order by a.rsn; The query is slow because the anchor select references table c which has lots of rows that satisfy the where clause and the anchor select looks at them all. How can I restrict the anchor clause to only look at related rows. I want the anchor clause to be something like select rsn from c where c.a_rsn = a.rsn and c.col6 = 1234 where a.rsn is the parent row related to a small subset of table c.