How to disable a SQL Server index?

How to disable a SQL Server index? To disable an index for performance reasons, use this code and adjust it to your index and table names. For instance, let’s consider a large sales table, with million lines. Let’s consider that the table has a non-unique and non-clustered index on the month.

How to disable a SQL Server index?

First of all, why it is better to disable an index on a given table?

In other words, to insert data faster in the table, it’s much better to disable this index. For instance, let’s use the same index from this article on how to create an index to disable it.

ALTER INDEX indexYearMonth ON [dbo].[SALES] DISABLE;

Moreover, this article presents a command to disable an index on the sales table. After been disabled, the index is not used anymore and it need to be rebuild to be enabled again.

Check this article on how to rebuild an index.

To sum up, more insights on disabling the indexes and constraints in database design documentation.

Be the first to comment

Leave a Reply

Your email address will not be published.


*