Why Are You Dropping and Recreating Your Indexes? | Database Journal

Why Are You Dropping and Recreating Your Indexes?

Written By
Gregory Larsen
Gregory Larsen
May 3, 2018
2 minute read

Do you have data load processes that drop indexes to optimize the load process?  Are you dropping those indexes in one step, then loading data into your table, only to recreate the indexes in a post data load step?  It is common practice to drop indexes and then create them to optimize the data load process. By not having the indexes at load time SQL Server can load the data much faster, because there are no indexes to update.  This is a common practice for optimizing loading large data warehouse table loads.

Does this sound familiar?  I have to ask you, why are you dropping and recreating your indexes, when you could just disable and then rebuild them.   By disabling an index, you have basically turned off the index, but have allowed SQL Server to retain the index definition in the database metadata.  If you want the index back all you need to do is rebuild the index.  

If you drop the index, SQL Server no longer retains the metadata for the index.  Therefore, if you want to recreate the index you will need to recreate the index with the CREATE INDEX statement.  Hopefully you can remember the exact syntax of your CREATE INDEX statement.  By disabling an index, you don’t have to remember the columns that make up your index, because SQL Server keeps that information for you.   Below is an example where I disabled an index, and then turned around and rebuilt it.  See how simple that it is. 

ALTER INDEX IX_Mytable_OrderDate ON MySchema.MyTable DISABLE;
GO
ALTER INDEX IX_Mytable_OrderDate ON MySchema.MyTable REBUILD;
GO
 
 

One last note. If you disable a clustered index, SQL Server makes the data for the table inaccessible until a rebuild operation.

See all articles by Greg Larsen

Gregory Larsen

Gregory A. Larsen is a DBA at Washington State Department of Health (DOH). Greg is responsible for maintaining SQL Server and other database management software. Greg works with customers and developers to design and implement database changes, and solve database/application related problems. Greg builds homegrown solutions to simplify and streamline common database management tasks, such as capacity management.

Database Journal Logo

DatabaseJournal.com publishes relevant, up-to-date and pragmatic articles on the use of database hardware and management tools and serves as a forum for professional knowledge about proprietary, open source and cloud-based databases--foundational technology for all IT systems. We publish insightful articles about new products, best practices and trends; readers help each other out on various database questions and problems. Database management systems (DBMS) and database security processes are also key areas of focus at DatabaseJournal.com.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.