mysql 5.7中关于count(*)的优化

在mysql 5.7中,对于select count(*) from table 的优化,可以
设置为:
select count(*) from table where uid>0
其中uid为辅助索引,辅助索引不存放数据,而是有一个指针指向对应的数据块,因此速度更快;


但注意到http://www.ywnds.com/?p=10369中提到的问题,要引起注意

猜你喜欢

转载自jackyrong.iteye.com/blog/2393908