MySQL Forums
Forum List  »  Performance

Re: count(*) or count(id)
Posted by: Rick James
Date: July 04, 2016 01:04PM

And, if `id` is the PRIMARY KEY, then it is known to be unique. So you will get the same answer.

Please use COUNT(*) so the reader (including yourself a year from now) won't have to wonder if there could be NULLs that are being avoided.

Options: ReplyQuote


Subject
Views
Written By
Posted
4498
June 28, 2016 06:22AM
1476
June 28, 2016 06:26AM
1282
June 28, 2016 05:18PM
Re: count(*) or count(id)
1401
July 04, 2016 01:04PM
1027
July 06, 2016 12:30AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.