Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I've got a couple of nonclustered indexes on tables that have rows inserted quite often. These indexes are currently around 90% fragmented, according to SQL Server. If I rebuild them, they go down to ~5% fragmentation but they quickly get back up to 90% in a couple of hours.

What's going on, why are my indexes so persistently fragmented, and do I need to worry about it?

share|improve this question
    
How big are the tables? If they're small then the fragmentation will be proportionally higher. –  SuperCoolMoss Apr 18 '12 at 11:13

1 Answer 1

up vote 4 down vote accepted

Nonclustered indexes get fragmented whenever page splits occur; this happens mostly when inserting non-sequential data, i.e. not in index order (it happens occasionally when inserting in index order, too - but not nearly as often.)

Consider rebuilding them with 50% padding, i.e. all current pages will be left half-empty.

This gives you the time required to double the index before fragmentation becomes an issue again.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.