一般情况下select count(*) 与select count(1)两者返回的结果一致。
但是针对表中主键的有无,情况会有不同。
无主键:count(1)比count(x)快
有主键:count(主键)最快
count(*)与count(1)都包括null统计,而count(column)不包括null统计
一般情况下select count(*) 与select count(1)两者返回的结果一致。
但是针对表中主键的有无,情况会有不同。
无主键:count(1)比count(x)快
有主键:count(主键)最快
count(*)与count(1)都包括null统计,而count(column)不包括null统计