• adonetok (8/11/2010)


    Which one is fast to get count of records?

    1)select count(*) from order

    2)select count(OrderID) from order (OrderID is primary key)

    I tested in 3894000 records table but both them are done in 0 second

    They'd have the same execution plans I'd imagine, so the same performance in this particular case.


    Forever trying to learn
    My blog - http://www.cadavre.co.uk/
    For better, quicker answers on T-SQL questions, click on the following...http://www.sqlservercentral.com/articles/Best+Practices/61537/
    For better, quicker answers on SQL Server performance related questions, click on the following...http://www.sqlservercentral.com/articles/SQLServerCentral/66909/