4 ms·
It should be the same. count(*) only needs to return the number of columns (regardless of its value), so it can use only indexes, while count(column) must only
by icebraining 12y ago
It should be the same. count(*) only needs to return the number of columns (regardless of its value), so it can use only indexes, while count(column) must only count non-null values. But since the primary is non-null, it should end up taking the same time.
- billyhoffman 12y agoWow, just tested this against a table with some pretty wide columns and ~ 7M rows. They take exactly the same time! I would have thought COUNT() would be like SELECT , but I guess the query planner is smart enough to know what to do. Thanks!