以前一直写sql从来没做过优化,这次碰到了傻了,感觉没啥问题啊,但是人家说效率低,可以提高。
不知道怎么办,求助高手~
1.select a from table where b <> 'aaaa' (table without index)
2.select * from table where b like '%a%'
3.select name from person where birthday in (select birthday from table)
4.select * from table where a = 10
我就知道第二个应该用全文索引,第三个是不是用exist代替in啊
其他两个完全没概念,坐等高手指点~

解决方案 »

  1.   

    如果不更改Table schema 
    好像只有第三个可以改select name from person a where exists (select 1from table b where a.birthday = b.birthday )
      

  2.   

    1.select a from table where b <> 'aaaa' (table without index)
    2.select * from table where b like '%a%' select * from table where instr(b,-1,'a')
    3.select name from person where birthday in (select birthday from table) select name from person a where exists (select 1from table b where a.birthday = b.birthday )4.select * from table where a = 10
    ----这个a是什么类型,如果是varchar2,就改为‘10’
      

  3.   

    a确实是varchar2类型的,这个问题解决了,第一个问题怎么解决呢?
      

  4.   


    我也不知道,1的原文是这样的,select 'not found' from userTable where memberid <> 'aaaa'
    我感觉能动的地方也就是'not found' 和后面的不等于号了。
      

  5.   


    第一个就要看你其它的值是什么了,如果其它的值不多,可以写成 = '' or = '' or 这个方法,不用 不等于,然后再增加个索引,该给分啦