Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Primary Keys and Clustered Indexes
Message
From
12/01/2001 08:16:57
 
General information
Forum:
Microsoft SQL Server
Category:
Database design
Miscellaneous
Thread ID:
00462472
Message ID:
00462864
Views:
10
> The reason is that each time you add or update a record with a clustered index, the entire indexing structure must be rebuilt. It is better to drop the clustered index, make all the updates you need to and then rebuild the indexes once.

Maybe I'm missing something here but SQL Server does not completely rebuild any index everytime a row is inserted, updated, or removed. When a row is inserted, SQL Server finds the proper position of the new key in all the indexes and inserts it. If there's not enough room on the page, the page is split and some of the keys are distributed to the new page. When a row is updated, any affected indexes are updated. If the index key was changed, the key is moved to it's new position. When a row is removed, all the indexes are updated and the applicable keys are removed.

As far as I know, the only time that an index is completely rebuilt is during maintainence activities, or when a Clustered index is dropped and/or created and non-clustered indexes already exist.

-Mike
Michael Levy
MCSD, MCDBA
ma_levy@hotmail.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform