November 23, 2026 at 12:00 am
Comments posted to this topic are about the item The Speed of Count
November 23, 2026 at 7:59 am
This is only true, when there is a narrow index on OrderDetailID, if the column is not indexed or just part of an index with 5 columns where another (not filtered) index with just a single column exists, COUNT(*) or COUNT(1) are faster (both are using the smallest index, when you don't use a WHERE / JOIN that would limit the result)
God is real, unless declared integer.
November 23, 2026 at 1:29 pm
That's true, Thomas. I wasn't assuming that OrderDetailID was indexed and considered to be NOT NULL.
LinkedIn: https://www.linkedin.com/in/sqlrv
Website: https://www.sqlrv.com
November 23, 2026 at 5:44 pm
Good point. In this case, with the known index structure, this is true.
I've adjusted the explanation to add this.
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply