在oracle 11g中优化自联接查询

时间:2015-02-26 10:01:28

标签: oracle oracle11g left-join oracle-sqldeveloper self-join

我正在尝试执行以下查询,需要更多时间才能执行。您能否说我如何优化此查询以更快的方式执行。另请说明如何理解EXPLAIN PLAN的结果?

SELECT DISTINCT T1.*,
                T3.*
FROM   table1 T1
       join table1 T2
         ON T2.no = T1.no
       left outer join table2 T3
                    ON T1.record_id = T3.record_id
WHERE  T2.standard IN ( 'TE' )
       AND Upper(T2.ind) = 'PRI'
       AND ( ( T2.input = 'SIT'
               AND T2.batch_no IS NOT NULL )
              OR T2.input <> 'SIT' )
       AND Upper(T1.ind) IN ( 'PRI', 'CNJ' )
       AND T1.id_no = T2.id_no
ORDER  BY T1.no,
          T1.ind DESC 

0 个答案:

没有答案