有个sql,结构类似
select table3.id,table3.parentid from ( Select table1.id,table1.parentid from table1 union Select table2.id,table2.parentid from table2) table3start with table3.parentid=0
connect by prior table3.id = table3.parentidstart with ....connect by prior ...没加的话,执行时间是1秒多,
加上之后执行时间变成10多秒
为什么会相差这么多?
select table3.id,table3.parentid from ( Select table1.id,table1.parentid from table1 union Select table2.id,table2.parentid from table2) table3start with table3.parentid=0
connect by prior table3.id = table3.parentidstart with ....connect by prior ...没加的话,执行时间是1秒多,
加上之后执行时间变成10多秒
为什么会相差这么多?
贴表格 数据 sql