Dropping an Index or Disabling and Rebuilding it
suggest changeSQL Server syntax:
DROP INDEX ix_cars_employee_id ON Cars;
DROP INDEX deletes the index. In this example it drops ix_cars_employee_id on Cars.
This deletes the index entirely and, if the index is clustered, removes the clustering. It cannot be rebuilt without recreating the index, which can be slow and computationally expensive. As an alternative, the index can be disabled:
ALTER INDEX ix_cars_employee_id ON Cars DISABLE;
This allows the table to retain the structure, along with the metadata about the index.
Critically, this retains the index statistics, so that it is possible to easily evaluate the change. If warranted, the index can then later be rebuilt, instead of being recreated completely;
ALTER INDEX ix_cars_employee_id ON Cars REBUILD;
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents