Sunday, February 12, 2012

clustered index fragmentation

Hi

I am testing some clustered index on a table I was working on. I put a clustered index on an int column with identity and insert some several thousand records into the table. I check the index fragmentation and notice that it was about 20%. I thought since the identity field is incremental, there would be little or no fragmentation. Is this true or is there something wrong with my server

thanks

Paul

A clustered index is a table (heap), indexed.
See:
Microsoft SQL Server 2000 Index Defragmentation Best Practices
http://www.microsoft.com/technet/prodtechnol/sql/2000/maintain/ss2kidbp.mspx#EJD|||When was the last time the DBREINDEX job executed? Try to update statistics on the involved tables for a performance gain.|||

When you created the index what fill factor did you use? Did you select the padding option?

|||The fragmentation on your tables are due to updates of the variable length columns and not due to inserts. An int column with identity is the best candidate for clustered index, as there wont be any fragmentation during inserts. However, when you update your tables and increase the data size of columns having variable length, than it is very likely of your table getting fragmented.
One suggestion is to use a fill factor depending on the frequency of updates of your variable length columns. Hope this helps :)

No comments:

Post a Comment