日期:2014-05-17  浏览次数:20859 次

一条SQL语句调优,急急
Select   ifdl.ifdl_dp_number,
              ifdh.ifdh_operations_type
    from   ifdpline   ifdl,   ifdphead   ifdh
  where   ifdl.ifdl_pid   =   ifdh.ifdh_id
      and   ifdl.ifdl_dp_number   like   'KMTC   ULSAN/701S/KMTC/E% '
      and   ifdl.ifdl_org_id   =   '139 '
      and   (ifdl.ifdl_cust_code   =   'ESSA00100489 '   or   ifdl.ifdl_vendor_code   =   'ESSA00100489 ')
      and   exists(select   1  
                                from   FEXPENSE   fexp,   FCONSIGN   fcsg
                              where   fexp.FEXP_CONSIGN_ID   =   fcsg.FCSG_CONSIGN_ID
                                  and   ( 'F '   ||   fexp.fexp_expense_id   ||   'C '   =   ifdl.ifdl_dp_line_number   or   'F '   ||   fexp.fexp_expense_id   =   ifdl.ifdl_dp_line_number))  

这个语句的and   ( 'F '   ||   fexp.fexp_expense_id   ||   'C '   =   ifdl.ifdl_dp_line_number   or   'F '   ||   fexp.fexp_expense_id   =   ifdl.ifdl_dp_line_number)导致了索引失效,有什么写法可以满足该业务并提高效率,谢谢大家

------解决方案--------------------
建函数索引,如果版本是9i或更高。