三种方法的效果如下(如果不是非常大的数据量,千万级,没有必要):只给uid建单字段索引的效果 select * from where uid=N分别给 uid和sid建单字段索引的效果, select * from where uid=N select * from where sid=M给 uid和sid建多字段索引的效果 select * from where uid=N and sid=M
修正一下二楼的说法: 三种方法的效果如下(如果不是非常大的数据量,千万级,没有必要):只给uid建单字段索引的效果 select * from where uid=N分别给 uid和sid建单字段索引的效果, select * from where uid=N or sid=M给 uid和sid建多字段索引的效果 select * from where uid=N and sid=M
select * from where uid=N分别给 uid和sid建单字段索引的效果,
select * from where uid=N
select * from where sid=M给 uid和sid建多字段索引的效果
select * from where uid=N and sid=M
http://topic.csdn.net/u/20090501/15/7548d251-aec2-4975-a9bf-ca09a5551ba5.html
三种方法的效果如下(如果不是非常大的数据量,千万级,没有必要):只给uid建单字段索引的效果
select * from where uid=N分别给 uid和sid建单字段索引的效果,
select * from where uid=N or sid=M给 uid和sid建多字段索引的效果
select * from where uid=N and sid=M