• mtillman-921105 (10/19/2010)


    kevin.l.williams (10/19/2010)


    If I saw any production code like 2, 3 or 4, the developer would get an ear full. I will stick with count(*) thank you very much.

    Maybe you're right for most everyday applications. I just tested SELECT COUNT(*) on a table with 5,900,000 rows and it was almost immediate. I think I'll stick with that too.

    I think that I was being too hard on MS earlier since COUNT(*) is accurate, even if it can be slow in some circumstances.

    COUNT(*) is only guaranteed accurate if your isolation level is REPEATABLE READ, SERIALIZABLE, or SNAPSHOT (or of course if you use HOLDLOCK).

    Tom