Mysql查询优化随笔记录
Posted 牛顿
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Mysql查询优化随笔记录相关的知识,希望对你有一定的参考价值。
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查询优化随笔记录的主要内容,如果未能解决你的问题,请参考以下文章
MYSQL性能调优06_分页查询优化JOIN关联查询优化in和exsits优化count(*)查询优化