阿神2017-04-18 09:42:38
You can see how your sql will be translated by mysql using the following sql
EXPLAIN EXTENDED
SELECT count(*) FROM `table`;
SHOW WARNINGS;
My version is mysql 5.6.26, the following is the translated result:
/* select#1 */ select count(0) AS `count(*)` from `test`.`table`
So, in my opinion, newer versions of mysql no longer have this difference, but I still use count(1) as a habit.
黄舟2017-04-18 09:42:38
When the data records are not empty, there will be no difference in the query results. But when the column queried by COUNT(1) is empty, the empty ones will be removed and not recorded in the statistics. The results of this query It’s different.