I have a very large SQL Server 2008 R2 database (1.5TB) and will be copying some data from column to column within the same table. I've been told that the schema has a large number of indexes and was wondering if there is a default query or script that will rebuild all the indexes. Have also been advised to update the statistics at the same time?
Each of the 30 tables has one clustered index and 13x non-clustered indexes
Thanks.
Best Answer
Try the following script:
Also
I prefer(After a long search) to use the following script, it contains
@fillfactor
determines how much percentage of the space on each leaf-level page is filled with data.for more info, check the following link:
https://blog.sqlauthority.com/2009/01/30/sql-server-2008-2005-rebuild-every-index-of-all-tables-of-database-rebuild-index-with-fillfactor/
and if you want to Check Index Fragmentation on Indexes in a Database, try the following script:
For more information, Check the following link:
http://www.schneider-electric.com/en/faqs/FA234246/