• CELKO (8/11/2010)


    The table row count (NOT records! quit thinking this is a mag tape file system) is available at the table level, so three is no need to scan the table.

    SQL will scan something to get a row count (from SELECT COUNT(*) or SELECT Count(<not nullable column>)). Not the table, unless there are no nonclustered indexes, but it will scan an index to do the row count, the one with the fewest leaf pages.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass