August 6, 2012 at 4:46 am
I have a table which has a clustered primary key on one int column, which is an identity (1, 1). The fill factor is 90%. The table has ~330k rows in. If I rebuild it, sys.dm_db_index_physical_stats indicates that its fragmentation is 0%. So far, so good.
However, if I then add rows, the fragmentation increases (from 0%). But I don't understand why - surely as the new rows will have ever-increasing values for the identity column, and as the index is both clustered and based on this column only, won't new values simply be added to the end of all existing ones, meaning no page splits will occur (and hence, no fragmentation)?
I've obviously misunderstood something along the way, so if anybody could enlighten me, I would be very grateful.
Thanks. Julian.
PS No rows are being deleted from the table and none are being updated.
August 6, 2012 at 6:47 am
How many rows per page?
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
August 6, 2012 at 7:12 am
This has been covered recently - may be of some help:
http://www.sqlservercentral.com/Forums/Topic872069-1550-1.aspx
August 6, 2012 at 7:48 am
Thanks for the reference. I'm not sure that explained why you'd get fragmentation on an index consisting solely of an increasing identity column where only inserts were being carried out and no updates.
Or have I missed something? Again.
August 6, 2012 at 2:56 pm
There's another one here you may not have seen:
http://www.sqlservercentral.com/Forums/Topic952029-391-2.aspx
Seems to go into a bit more depth - again not sure it if it will answer your question...
August 7, 2012 at 2:01 am
Oooh yes, that looks like it might be just the ticket. Thanks very much.
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply