Home > Database > Mysql Tutorial > body text

mysql千万级的count统计对比_MySQL

WBOY
Release: 2016-06-01 13:31:04
Original
2578 people have browsed it

bitsCN.com

mysql千万级的count统计对比

 

数据库:mysql 5.5 

数据量:45199077 条

 

sql语句:

[sql] select count(1) from tbresult;  select count(id) from tbresult;  
Copy after login

 

查询时间对比图:

 

mysql千万级的count统计对比_MySQL
mysql千万级的count统计对比_MySQL

 

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

 

下面是重启后的对比图

 

mysql千万级的count统计对比_MySQL

 

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

 

mysql千万级的count统计对比_MySQL

bitsCN.com
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template