Execution plan显示没有用到所引,使用hint /*+index()*/

解决方案 »

  1.   

    lower(per_name) like '%john%'  这样是用不上索引的
    把这个优化了。。
      

  2.   

    select 
          distinct  * 
    from 
          person,addr,contract
    where 
          instr(lower(per_name),'john')>0 and
          con_type = 'I' and
          con_tin = per_ssn  and
          con_number = add_num and
         (add_type in ('01','29') or add_address_type = '02')
      

  3.   

    select 
            * 
    from 
          person,addr,contract
    where 
          lower(per_name) like '%john%' and
          con_type = 'I' and
          con_tin = per_ssn  and
          con_number = add_num and
         (add_type = '01' or add_address_type = '02' or add_type = '29')
    group by person.OPERATION
      

  4.   

    group by 比distinct的速度开多了
      

  5.   

    看一下索引的用法,印象里:索引的顺序和WHERE字句中引用字段的顺序要一致;如果字段本身取值只有几个(如2个)没必要建索引;使用函数通常用不到索引。
    hope it's helpful !