We have seeing some strange behavior when rebuilding indexes.
· Total Fragmentation prior to rebuild is 99%.
· You rebuild the index. (using both the alter index and the dbcc dbreindex)
· Fragmentation is at 0%
· You recheck fragmentation about a minute later.
· Fragmentation is at 99% again.
· You have verified that there are no DML's being done on that table.
We noticed that the database has “Auto Shrink” enabled.
After we disabled the auto shrink, it’s working fine.
PingBack from http://geeklectures.info/2008/01/10/db-autoshrink-option-may-introduce-high-fragmentation/
This has been a well known issue for many years - I even had Books Online updated for 2005 when I was at MS to advise against auto-shrink and shrink in general.
See http://www.sqlskills.com/blogs/paul/2007/11/13/AutoshrinkTurnItOFF.aspx for a detailed explanation of this along with a script that shows shrink causing total fragmentation in an index.
It's common knowledge that shrinking a database leads to internal fragmentation.
thank you great article. Save my files.