mysql千万级的count统计对比_MySQL
来源:动视网
责编:小采
时间:2020-11-09 18:42:51
mysql千万级的count统计对比_MySQL
mysql千万级的count统计对比_MySQL:bitsCN.com mysql千万级的count统计对比 数据库:mysql 5.5 数据量:45199077 条 sql语句:[sql] select count(1) from tbresult; select count(id) from tbresult; 查询时间对比图: 总结:在统计查询的时候尽量使用count(id),
导读mysql千万级的count统计对比_MySQL:bitsCN.com mysql千万级的count统计对比 数据库:mysql 5.5 数据量:45199077 条 sql语句:[sql] select count(1) from tbresult; select count(id) from tbresult; 查询时间对比图: 总结:在统计查询的时候尽量使用count(id),
bitsCN.com
mysql千万级的count统计对比
数据库:mysql 5.5
数据量:45199077 条
sql语句:
[sql] select count(1) from tbresult; select count(id) from tbresult;
查询时间对比图:


总结:在统计查询的时候尽量使用count(id),不要使用count(*)这样的;特别是数据量特别大的时候。
下面是重启后的对比图

重启mysql并把sql语句换位置后的结果:

bitsCN.com
mysql千万级的count统计对比_MySQL
mysql千万级的count统计对比_MySQL:bitsCN.com mysql千万级的count统计对比 数据库:mysql 5.5 数据量:45199077 条 sql语句:[sql] select count(1) from tbresult; select count(id) from tbresult; 查询时间对比图: 总结:在统计查询的时候尽量使用count(id),