How To Defragment Table Indexes?
Submitted by: AdministratorWhen a table index is fragmented to a certain percentage, you need to defragment the index to maintain its performance level. There are 3 ways to defragment:
1. "ALTER INDEX index_name ON table_name REORGANIZE" - Defragmenting the specified index performed in online mode. No locks applied on affected table. Used for indexes with a small fragmentation percentage.
2. "ALTER INDEX index_name ON table_name REBUILD" - Defragmenting the specified index performed in offline mode by default. It can be performed in online mode. Used for indexes with a large fragmentation percentage.
3. "CREATE INDEX ... WITH (DROP_EXISTING = ON)" - Re-creating the specified index. The definition of the index can be changed.
Submitted by: Administrator
1. "ALTER INDEX index_name ON table_name REORGANIZE" - Defragmenting the specified index performed in online mode. No locks applied on affected table. Used for indexes with a small fragmentation percentage.
2. "ALTER INDEX index_name ON table_name REBUILD" - Defragmenting the specified index performed in offline mode by default. It can be performed in online mode. Used for indexes with a large fragmentation percentage.
3. "CREATE INDEX ... WITH (DROP_EXISTING = ON)" - Re-creating the specified index. The definition of the index can be changed.
Submitted by: Administrator
Read Online MS SQL Server Job Interview Questions And Answers
Top MS SQL Server Questions
☺ | PHP MSSQL - How To Display a Past Time in Days, Hours and Minutes? |
☺ | How To Find Out What Is the Default Collation in a Database? |
☺ | How To Use Subqueries with the IN Operators in MS SQL Server? |
☺ | How To Create a Testing Table with Test Data in MS SQL Server? |
☺ | How To Configure and Test ODBC DSN Settings? |
Top Databases Programming Categories
☺ | RDBMS Interview Questions. |
☺ | SQL Interview Questions. |
☺ | SSRS Interview Questions. |
☺ | Sybase Interview Questions. |
☺ | Database Administrator (DBA) Interview Questions. |