sql优化

oracle9i  ITF_INS_DECL_MAG表500万数据,INSP_DECL_CONT表20万条数据

原始sql,执行时间14s:

select insp_require
   from ITF_INS_DECL_MAG@ECIQ_DATA.US.ORACLE.COM
  where decl_no = (select ent_decl_no
                     from INSP_DECL_CONT
                    where cont_DECL_NO = '32740012019F00894');

 

优化1,执行时间1s

select insp_require
   from ITF_INS_DECL_MAG@ECIQ_DATA.US.ORACLE.COM
  where decl_no = '119000003049483';

 

优化2,执行时间1s

  select insp_require
    from ITF_INS_DECL_MAG@ECIQ_DATA.US.ORACLE.COM a, INSP_DECL_CONT b
   where a.decl_no = b.ent_decl_no
     and cont_DECL_NO = '32740012019F00894'

你可能感兴趣的:(oracle优化)