Which DBCC command is not needed in this code? | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Which DBCC command is not needed in this code?

I run these commands nightly on a database that had a high amount of inserts and needs to be optimized nightly. Here is the code that I run nightly, but it is starting to take too long to run. Which commands are redundant? DBCC DBREINDEX (tablename)
UPDATE STATISTICS tablename WITH FULLSCAN, ALL
DBCC UPDATEUSAGE(database, tablename) WITH COUNT_ROWS
DBCC CHECKTABLE(tablename)
DBCC CHECKDB(database)
DBCC CHECKALLOC (database) Thanks in advance to any responses to this post. Live to Throw
Throw to Live

— Below dbcc commands will do the all work. DBCC DBREINDEX (tablename)
DBCC CHECKDB(database) Deepak Kumar –An eye for an eye and everyone shall be blind
quote:Originally posted by Will192 I run these commands nightly on a database that had a high amount of inserts and needs to be optimized nightly. Here is the code that I run nightly, but it is starting to take too long to run. Which commands are redundant? DBCC DBREINDEX (tablename)
UPDATE STATISTICS tablename WITH FULLSCAN, ALL
DBCC UPDATEUSAGE(database, tablename) WITH COUNT_ROWS
DBCC CHECKTABLE(tablename)
DBCC CHECKDB(database)
DBCC CHECKALLOC (database) Thanks in advance to any responses to this post. Live to Throw
Throw to Live

After DBCC DBREINDEX(tablename) there is no need to run UPDATE STATISTICS … I think also DBCC CHECKTABLE is not required. Surendra Kalekar
I thought the DBREINDEX did the UPDATE STATISTICS and UPDATEUSAGE. I didn’t think about removing the CHECKTABLE and CHECKALLOC. Thanks. Live to Throw
Throw to Live
Yes the DBCC DBREINDEX will update the statistics and arrange the table for optimum performance, so no need for other DBCC’s to reduce the servr resource usage unnecessarily. Satya SKJ
Moderator
http://www.SQL-Server-Performance.Com/forum
This posting is provided “AS IS” with no rights for the sake of knowledge sharing.
]]>