February 17, 2005 at 12:09 pm
I am trying to manage the fragmentation of tables and indexes in a database. Following the example in BOL, I created a script that runs the command DBCC SHOWCONTIG WITH FAST, TABLERESULTS, ALL_INDEXES and saves the results to a table. Then it runs either DBREINDEX or DBCC INDEXDEFRAG depending on the level of logical fragmentation.
The mystery is this.....
For some tables, the logical fragmentation reported with DBCC SHOWCONTIG WITH FAST, TABLERESULTS, ALL_INDEXES differs from the value returned from DBCC SHOWCONTIG(<tablename>. Also, executing DBREINDEX appears to be having no affect on the results returned from DBCC SHOWCONTIG for the whole database.
Any thoughts on what is happening here?
Gordon Pollokoff
"Wile E. is my reality, Bugs Bunny is my goal" - Chuck Jones
February 21, 2005 at 8:00 am
This was removed by the editor as SPAM
February 21, 2005 at 3:39 pm
I am not 100% sure of what you are seeing. Thought I would toss some ideas at you anyway...
Specifying ALL_INDEXES returns results for all the indexes in a table seperately. Without ALL_INDEXES you get the report for data pages of the table..which could be the clustered index(index id = 1) or the heap(index id = 0).
Fragmentation occurs on the index level so be sure to look at all of the indexes. They do not fragment at the same rates.
I never used FAST but am pretty confident that will vary the results as well.
"Keep Your Stick On the Ice" ..Red Green
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply