码迷,mamicode.com
首页 > 数据库 > 详细

Mysql查询优化随笔记录

时间:2016-06-24 10:38:27      阅读:172      评论:0      收藏:0      [点我收藏+]

标签:

select SQL_CALC_FOUND_ROWS * from (select * from  oses_vehdata201606 union all  select * from  oses_vehdata201605)  t where 1=1 and t.Check_Time between ‘2016-06-23 00:00:00‘ and ‘2016-06-23 23:59:59‘  order by Check_Time desc 

结果:45.66 s 、36.5s

select SQL_CALC_FOUND_ROWS * from (select * from  oses_vehdata201606)  t where 1=1 and t.Check_Time between ‘2016-06-23 00:00:00‘ and ‘2016-06-23 23:59:59‘  order by Check_Time desc 

结果:8s、9s

select SQL_CALC_FOUND_ROWS * from (select * from  oses_vehdata201605)  t where 1=1 and t.Check_Time between ‘2016-06-23 00:00:00‘ and ‘2016-06-23 23:59:59‘  order by Check_Time desc 

结果:7s

select SQL_CALC_FOUND_ROWS * from oses_vehdata201606  t where 1=1 and t.Check_Time between ‘2016-06-23 00:00:00‘ and ‘2016-06-23 23:59:59‘  order by Check_Time desc 

结果:0.176s、0.052

数据库优化博客http://www.ihref.com/read-16422.html

MySQL索引和查询优化

 

Mysql查询优化随笔记录

标签:

原文地址:http://www.cnblogs.com/sunrunzhi/p/5613099.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!