June 24, 2021 at 1:02 am
Do I still need to run sp_updatestats if I execute DBCC DBREINDEX(tablename) for tables in database?
I think you should still use to run sp_updatestats as dbcc dbreindex doesn't the statistics created by create statistics, is it right? thanks!
June 24, 2021 at 6:25 am
You don't have to update statistics after rebuilding indexes. When you rebuild an index SQL server also rebuilds it's statistics. Since it reads all the records in the table, the statistics will be based on all the records and will be very accurate. If you update the statistics after that, SQL server will read only a sample of the table and you'll have less accurate statistics.
I have to admit that I don't remember if SQL Server 2012 has the alter index statement. If it does, then you should consider using it instead of DBCC DBRINDEX statement which is going to be removed in the future.
Adi
June 24, 2021 at 10:57 pm
Do I still need to run sp_updatestats if I execute DBCC DBREINDEX(tablename) for tables in database?
I think you should still use to run sp_updatestats as dbcc dbreindex doesn't the statistics created by create statistics, is it right? thanks!
You should stop using DBCC DBREINDEX and use ALTER INDEX REBUILD instead. It's been a part of SQL Server since at least 2005, IIRC.
Also, you're still going to need to rebuild some statistics... those would be the column statistics that aren't associated with any index.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply