I’m wondering if there is a difference performance wise between using COUNT(*) and COUNT(date_created). I’ve read that the only semantic difference is that COUNT(*) also includes NULL values, however the date_created field is not nullable in this specific case.
I’ve looked at various posts and none really answer this question for MySQL. The best I’ve found is a comment by @tsilb on this thread.
If you have an index on
date_created, there will be no difference. If it’s an unindexed column, you’ll end up doing a full table scan. When you have questions like this, you can find out a lot by usingEXPLAIN SELECT COUNT(*) FROM my_tableand comparing that toEXPLAIN SELECT COUNT(date_created) FROM my_table.