Click here to Skip to main content
15,881,559 members
Please Sign up or sign in to vote.
4.50/5 (3 votes)
See more:
Quick question Guys, if I add a column to an existing table with indexes on it, will all indexes then be rebuild ?
Posted
Comments
Herman<T>.Instance 25-Sep-14 6:12am    
good question! I really wouldn't know. But what if you would test it in SSMS and use profiler to see what is happening after the ADD COLUMN!

Indexes extract information for speeding the retrieval of information, and indexes are bound to one or more columns at the time of creation (and updated by changes in row content).

So by adding a new column you will not affect previous indexes since they essentially don't care for that column.
 
Share this answer
 
No. Indexes are "shortcut" sorted versions of the existing columns. For new columns, there is no need to rebuild existing indexes. But if you change the datatype of a column that is affected by an index, it rebuilds that index only.
 
Share this answer
 
Yes,
 Rebuilding Indexes happens Rebuilding an index drops and re-creates the index.
And Modifies a table definition by altering, adding, or dropping columns and constraints, reassigning and rebuilding partitions, or disabling or enabling constraints and triggers. 


ALTER TABLE
SQL
Indexes created as part of a constraint are dropped when the constraint is dropped. Indexes that were created with CREATE INDEX must be dropped with DROP INDEX. The ALTER INDEX statement can be used to rebuild an index part of a constraint definition; the constraint does not have to be dropped and added again with ALTER TABLE.
All indexes and constraints based on a column must be removed before the column can be removed.
When a constraint that created a clustered index is deleted, the data rows that were stored in the leaf level of the clustered index are stored in a nonclustered table. You can drop the clustered index and move the resulting table to another filegroup or partition scheme in a single transaction by specifying the MOVE TO option. The MOVE TO option has the following restrictions:


Get More INFO
msdn part 1[^]
msdn part 2[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900