资料来源于网络,仅供参考学习。
CREATE TABLE test(
a INT,
b INT,
c INT,
KEY idx(a,b,c)
);
优: SELECT * FROM test WHERE a=10 AND b>50;
差: SELECT * FROM test WHERE b>50;
优: SELECT * FROM test ORDER BY a;
差: SELECT * FROM test ORDER BY b;
差: SELECT * FROM test ORDER BY c;
优: SELECT * FROM test WHERE a=10 ORDER BY a;
优: SELECT * FROM test WHERE a=10 ORDER BY b;
差: SELECT * FROM test WHERE a=10 ORDER BY c;
优: SELECT * FROM test WHERE a>10 ORDER BY a;
差: SELECT * FROM test WHERE a>10 ORDER BY b;
差: SELECT * FROM test WHERE a>10 ORDER BY c;
优: SELECT * FROM test WHERE a=10 AND b=10 ORDER BY a;
优: SELECT * FROM test WHERE a=10 AND b=10 ORDER BY b;
优: SELECT * FROM test WHERE a=10 AND b=10 ORDER BY c;
优: SELECT * FROM test WHERE a=10 AND b=10 ORDER BY a;
优: SELECT * FROM test WHERE a=10 AND b>10 ORDER BY b;
差: SELECT * FROM test WHERE a=10 AND b>10 ORDER BY c;
原文地址:https://www.cnblogs.com/huangzejun/p/8143718.html