使用explain查看执行计划, 下面是针对这两条语句进行分析,其查询结果是一样的。
EXPLAIN select n.id,n.title from info n inner join info_tags t on n.id=t.info_id where t.category_id=20 order by id desc limit 8;
EXPLAIN select n.id,n.title from info n inner join (select info_id as id from info_tags t where t.category_id=20 order by id desc limit 8) as page USING(id);
第一条语句结果:
第二条语句结果
具体参数分析请点击下面链接:
http://blog.csdn.net/c_enhui/article/details/9021271