当前位置:Gxlcms > 数据库问题 > Mysql查询优化随笔记录

Mysql查询优化随笔记录

时间:2021-07-01 10:21:17 帮助过:1人阅读

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查询优化随笔记录

标签:

人气教程排行