您的位置:首页 > 数据库 > MySQL

MySQL 语句优化

2016-06-09 17:54 267 查看
select * from b_common_product_param where cname = 'Type' order by ename limit 100000, 10;

select * from b_common_product_param INNER JOIN
(select id from b_common_product_param where cname = 'Type' order by ename limit 100000, 10) as x using (id);

#第一条Sql查询时间:49.612
#第二条Sql查询时间:22.545
表数据:12740129

用于表连接时给定连接条件(可以理解为简写形式),如
SELECT * FROM table1 JOIN table2 ON table1.id = table2.id

使用 USING 可以写为:

SELECT * FROM table1 JOIN table2 USING(id)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  MySQL 语句优化