• mtillman-921105 (10/21/2010)


    Tom.Thomson (10/21/2010)


    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).

    For real? I'll have to look into that Tom. By the way, NULLs do count in a COUNT(*) - I did notice that. 😀

    I cannot completely agree.

    In fact, COUNT(*) under REPEATABLE READ may return wrong results. I wrote a repro script here: