Difference between count (*) and count (1) and count (column name)
Execution result:
Count (*) includes all columns, equivalent to the number of rows. During the statistical result, the column value is not ignored as null.
Count (1) includes ignoring all columns, represented by 1CodeRow. The column value is null.
Count (column name) only includes the column name. During the statistical result, the column value is ignored as null (null indicates null instead of a null string or 0) when a field value is null, no statistics are collected.
Execution efficiency:
The column name is the primary key, and count (column name) is faster than count (1 ).
If the column name is not the primary key, count (1) is faster than count (column name ).
If multiple columns in the table have no primary keys, the execution efficiency of Count (1) is higher than that of Count (*)
If a primary key exists, the execution efficiency of select count (primary key) is optimal.
If the table has only one field, select count (*) is optimal.