Is there any performance difference in the below given three queries.
Note: Col1 is NOT NULL column
SELECT COUNT(*) FROM Sales.SalesOrderDetail;
SELECT COUNT(Col1) FROM Sales.SalesOrderDetail;
SELECT COUNT(0) FROM Sales.SalesOrderDetail;
Good question. I ran all 3 of these statements as a batch substituting SalesOrderID for Col1 and displayed the estimated execution plan. The estimated plan showed the cost of each query to be the same at 33%.
Just out of curiosity I then added Query 4 from the question and according to the estimated execution plan it is still the fastest. They all were equally accurate.