本帖最后由 lyp_2008001 于 2013-01-12 15:45:13 编辑

解决方案 »

  1.   

    1、select * from userinfo where user='abc';
    2、select * from userinfo where user='abc' or user='123';
    4、select * from userinfo where user like 'ab%c';
    5、select * from userinfo where user like 'abc%';
    这些可以用上。 具体为什么,建议你还是看MYSQL官方免费手册中的优化那个章节。一两百个字估计无法讲清楚。
      

  2.   

    优化那个章节中讲述了,MYSQL如何利用索引,什么情况下可以利用索引。
      

  3.   

    1 2 4 5可以用到索引   你可以explain select xxxxx 就可以看看走没走索引了 至于为什么走索引  建议先研究下索引原理
      

  4.   

    如果第二条sql语句改成:select * from userinfo where user='abc' or pass='123' 或者
    select * from userinfo where user='abc' and pass='123' ,这两个sql语句用到上面的索引了吗?