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)
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中的integer 数据类型
- MySQL存储过程
- mysql中int、bigint、smallint 和 tinyint的区别与长度
- mysql load data 导出、导入 csv
- source命令执行SQL脚本文件
- MySQL创建用户及权限控制
- MySQL管理数据表
- linux下mysql添加用户
- mysql procedure
- mysql触发器
- MySQL 备份和恢复策略
- mac下安装mysql(转载)
- mysql 修改编码 Linux/Mac/Unix/通用(杜绝修改后无法启动的情况!)
- MySQL数据的导出、导入(mysql内部命令:mysqldump、mysql)
- mysql数据行转列
- Linux下修改MySQL编码的方法
- MySQL Server 日志
- MySQL 安全事宜
- MySQL 备份与恢复