Sql-server – Adding a Clustered index, should I drop the nonclustered indexes

sql serversql server 2014

I am adding a clustered index as an online operation to a table that has 3 billion rows. It has taken over 17 hours so far. If I do this again on another table with just as many rows should I first drop the nonclustered indexes?

Best Answer

Dropping the nonclustered indexes will make converting the heap to a clustered index faster since those nonclustered indexes will not need to be updated.

However, you probably will want to recreate them after the conversion process is complete, so make sure you script the CREATE INDEX scripts prior to dropping them.

Be aware, dropping the nonclustered indexes means any queries that run during the conversion may run very slowly since they may be expecting indexes that are no longer there.