I see a common practice with DBAs: If you have to rebuild a HEAP, you will create a clustered index and drop it – this two phase process does the rebuild job, but is expensive. SQL Server supports ALTER TABLE REBUILD command to rebuild a heap.
Creating a dropping a clustered index, the old technique, is expensive since it has to update all the non-clustered indexes with the correct pointer, twice! When you create a clustered index, it updates all the non-clustered indexes with a pointer to the clustering key. When you drop the clustered index, it updates all non-clustered indexes with a pointer to the RID (HEAP). So in this technique, non-clustered indexes are rebuilt twice.
Instead, use SQL Server ALTER TABLE REBUILD command and the non-clustered indexes are rebuilt only once.
Here is a quick example to show the performance difference:
I create a table and a few non-clustered indexes:
use AdventureWorks2012 go --drop table person.persontemp select * into Person.PersonTemp from Person.Person CREATE NONCLUSTERED INDEX