标签:
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
标签:
原文地址:http://www.cnblogs.com/sunrunzhi/p/5613099.html