SQL SERVER – ReIndexing Database Tables and Update Statistics on Tables
undefined
undefined
When any data modification operations (INSERT, UPDATE, or DELETE statements) table fragmentation can occur.
DBCC DBREINDEX statement can be used to rebuild all the indexes on all the tables in database.
DBCC DBREINDEX is efficient over dropping and recreating indexes.
DBCC DBREINDEX --This feature will be removed in a future version of Microsoft SQL Server
Execution of Stored Procedure sp_updatestats at the end of the Indexes process ensures updating stats of the database.
USE DATABASENAME
GO
EXEC sp_MSforeachtable @command1="print '?' DBCC DBREINDEX ('?', ' ', 80)"
GO
EXEC sp_updatestats
GO
Alternate :
USE DATABASENAME
GO
EXEC sp_MSforeachtable @command1="print '?' ALTER INDEX ALL ON ? REBUILD WITH (ONLINE = ON, FILLFACTOR = 90)"
GO
EXEC sp_updatestats
GO
Subscribe to:
Post Comments (Atom)
- SSIS Logging Table Customizing
- Getting column description and Update descriptions in SQL Server
- SQL SERVER Start and Stop services Using SSIS
- SQL Server log shrinking Issue
- Dynamic Pivot on Single Column in a Table Sql Server 2008
- Run same command on all SQL Server databases without cursors
- SQL SERVER – ReIndexing Database Tables and Update Statistics on Tables
- Delete Original Data and maintain history with single SQl statement......(Magic tables)
- SQL Server Recursive CTE
- SQL Server Advanced Queries
- Which index will SQL Server use to count all rows
- SQL Server Performance Tips
- Sql Server Temporary Tables vs Table Variables
- Differences between sqlserver 2000, 2005 and 2008 versions
- SSIS Interview Quesions and Answers
0 comments:
Post a Comment