select * from test where val=4 limit 300000,5;
与
select * from test a inner join (select id from test where val=4 limit 300000,5) b on a.id=b.id;
的区别
id 自增唯一索引 val 非唯一索引
前者会查询300005次索引节点,查询300005次聚簇索引的数据
后者会查询300005次索引节点,查询5次聚簇索引的数据
select * from test where val=4 limit 300000,5;
与
select * from test a inner join (select id from test where val=4 limit 300000,5) b on a.id=b.id;
的区别
id 自增唯一索引 val 非唯一索引
前者会查询300005次索引节点,查询300005次聚簇索引的数据
后者会查询300005次索引节点,查询5次聚簇索引的数据
本文标题:一个查询的优化
本文链接:https://www.haomeiwen.com/subject/dtxcmhtx.html
网友评论