CT Count (*) from list or select count (ID) from list
Which of these two days query statements is faster?
Reply content:
CT Count (*) from list or select count (ID) from list
Which of these two days query statements is faster?
Select COUNT (*) from list
The number of rows stored in the MyISAM engine.
Depending on whether you are indexing on the ID or not, in MySQL, for example, use the index for the Count (*) MySQL optimizer as much as possible to speed up the query
COUNT (*) is fast, and count (field name) requires extra action. The former is the number of rows to get a match, and the latter is the number of non-null for the specified field, which is not a meaning at all.
such as a table test, only one field ID, two rows of records are
5
(NULL)
Select COUNT (*) is 2 and select COUNT (ID) is 1
If the actual item should be, that can only write select count (ID) from list. At work you write *, a little knowledgeable, will know that you are a novice.