|
我也碰到个类似的问题。
select * from some_table where org_id =0
or org_id in (select org_id from org_table start_with org_id = 0 connect by prior org_id = parent_org_id)
table不算大,也就几千笔,然后执行计划里出现filter,需要花几秒钟。
稍微改一下
select * from some_table where or org_id in (
select 0 from dual
union all
select org_id from org_table start_with org_id = 0 connect by prior org_id = parent_org_id)
变成nest loop, 几毫秒就OK乐 |
|