Today, the small white development encountered such a problem in the development process, the business table query, but you need to configure query to match the data in the table, because the configuration table needs to be recursive, so wrote the query:
Select * from persion a where exists
(select 1 from
Pe_zhi_db
Where a.u ser name=code
Start with id='00000000'
Connect by the prior id=parent_id)
Ten thousand persion table data, pe_zhi_db table four hundred thousand data, which statement query two or three minutes,
Feel very slow, statements are changed to:
Select * from persion a
Where the exists (select 1 from (select code from pe_zhi_db start with id='00000000' connect by the prior id=parent_id) where a.u sername=code)
Results instantly check out results,
Baidu the oracle recursion and recursive will perform the where, after the completion of the
Two different kind of statement is written, but the efficiency is much better, really not sure why, strives for the great god,