DBCC UPDATEUSAGE and EM question

  • Any enlightment appreciated!

    Today a programmer presented me a row count of a table via "select count(*) from ...." and the row count for the same table as seen from the eyes of EM. The number under EM was 47420 while the number from Query Analyzer shows 47569.

    I ran

    DBCC UPDATEUSAGE

    ('MyDatabase')

    WITH COUNT_ROWS

    and that fixed the problem.

    Question 1: Apparently many developers trust the EM interface as much as QA and were startled by the difference.

    Should I run DBCC UPDATEUSAGE daily to keep the programmers happy or is there a better approach?

    Question 3: According to BOL

    >>>

    DBCC UPDATEUSAGE

    Reports and corrects inaccuracies in the sysindexes table, which may result in incorrect space usage reports by the sp_spaceused system stored procedure.

    >>>>

    Why do these inaccuries happen in the first place and what other anomalies are cause by this?

    TIA,

    Bill

  • The stored proc sp_spaceused uses the values taken from the sysindexes system table.

    The values in sysindexes are not guaranteed to be accurate, as some bulk operations don't correctly update them.

  • FOr the most part it is only the count you will run into that gives this problem in EM and needs to be updated. But

    1) Developers make many more mistakes besides trusting count in EM, make sure they become aware of these things as soon as possible and that they verify the data themselves.

    2) No that would just make them lazy and the count can get out of sync at any point. Running makes no guarantee.

    3) ianscarlett covered.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply