Why does DBREINDEX solve update query hang with high CPU and little or no I/O?

  • Question: What causes the high CPU -- low I/O behavior and why is it cured by DBREINDEX?

    Background:

    Running SQL Server 2000. Over the past few years we've had situations where code that was running fine will suddenly hang. Using sp_who2 I can see that the process is doing little I/O but CPU usage is very high. I've seen it where an update that usually executes in under a minute can suddenly take several hours -- if it completes at all. I have learned that killing the query and doing a DBCC DBREINDEX on the table being updated will solve the problem. I have seen this occur on different tables and the DBREINDEX seems to be the cure.

    - Randall Newcomb

  • Probably bad execution plan due to out of date stats and probably because DBREINDEX updates stats.

    Try UPDATE STATISTICS next time, see if it helps.

    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
  • Thanks for the response. I'll give UPDATE STATISTICS a try next time I encounter the issue since it would probably be faster than DBREINDEX.

    Do you recall if DBCC INDEXDEFRAG also updates statistics?

    - Randall Newcomb

  • randall.c.newcomb (6/5/2009)


    Do you recall if DBCC INDEXDEFRAG also updates statistics?

    It does not.

    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

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

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