一个table 3个相同的类型的field分别为a,b,c
Q: 下面三个语句哪个执行效率高,速度快引用:
1.select * from table where a = .. and c = ..;
2.select * from table where b= .. and c = ..;
3.select * from table where a = .. and b =.. and c = ..;
A: 如果不考虑3个字段的索引,那么第3条最快
在mysql里,条件查询越多,速度就越快。
即使不需要查询条件,在大数据量下, select * from table where 1=1 也比 select * from table 快