寻求高手解答where从句后面条件顺序对性能的影响
如下,两条sql
select * from tables where id = 123 and type = 'movie';
select * from tables where type = 'movie' and id = 123;
在实际生产中可能不是这样的需求,但是大致问题就是,需要把过滤的数据多的放前面呢,还是把有索引的条件放前面,还是说他们存放的顺序没有影响!
如下,两条sql
select * from tables where id = 123 and type = 'movie';
select * from tables where type = 'movie' and id = 123;
在实际生产中可能不是这样的需求,但是大致问题就是,需要把过滤的数据多的放前面呢,还是把有索引的条件放前面,还是说他们存放的顺序没有影响!
2017-06-28
举报