Although count (*) and count (COL) may have different performance under different circumstances.
However, in general, count (*) performs an index scan on the primary key, which counts the total number of records that meet the requirements in the table. Count (COL) does not necessarily scan the primary key, it counts the number of records of all the compliant Col columns in the table.
For the following two queries:
Select count (*) from tbl_name;
Select count (COL) from tbl_name;
If col is the primary key, count (*) and count (COL) should have equivalent performance; otherwise, count (*) is faster than count (COL.
The following is a summary of others' optimizations:
MySQL's count optimization summary: 1. select count (*) from tablename is the optimal choice under any circumstances; 2. minimize the number of queries such as select count (*) from tablename where Col = 'value'; 3. prevent the appearance of select count (COL) from tablename.
Reference connection: http://www.ccvita.com/347.html