时间:2021-07-01 10:21:17 帮助过:46人阅读
资料来源于网络,仅供参考学习。
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;
MySQL 最左前缀(Leftmost Prefix) & 组合索引(复合索引,多列索引)
标签:body rom order 组合 table gpo ble 复合 int