今天写了一个统计sql,在一个近亿条数据的表上执行,200s都查不出结果.SQL如下: select customer,count(1) c from upv_** where created between "2015-07-06" and "2015-07-07" group by customer having c > 20 order by c desc 执行explain,发现这个sql扫描了8000W条记录到磁盘上.然后再进行筛选.type=ind…
[转自:https://blog.csdn.net/bruce128/article/details/46777567]并进行总结 今天写了一个统计sql,在一个近亿条数据的表上执行,200s都查不出结果.SQL如下: ) c from upv_** where created between "2015-07-06" and "2015-07-07" group by customer having c > order by c desc 执行explain…