x
login about faq Site discussion (meta-askssc)

Index Fragmentation

Hi,

In order to deal with index fragmentation, I have set up a nightly maintenance plan that does index rebuild on line and 90% fill factor. But this maintenance plan does not de-fragment the indexes fully. therefore I do need to manually rebuild the indexes. I have a session with Microsoft Premium Engineers and they just informed that maintenance plan task can not completely does this de-fragmentation. I need to do that manual rebuild. But I am not happy with their answer as I can not understand why can't it do that? Can anyone explain me the reason of this? Also can we rebuild the index online through SSMS?

Regards Zahid

more ▼

asked Jan 11 '12 at 07:56 AM in Default

Zahid gravatar image

Zahid
91 8 9 11

I agree, I would be curious as to why they are saying that the index plan is not completing. I am not a big fan of the plans, and even more so for databases that have any sort of production on them.

One think you may want to consider is using a script to rebuild your indexes. There are a couple really good ones out there:

SQLFool (http://sqlfool.com/2009/03/automated-index-defrag-script/) Ola Hallengren (http://ola.hallengren.com/)

One of the reasons that I recomend doing this is because this way you can re-index only those indexes that need it.

Jan 11 '12 at 08:18 AM Chris shaw
(comments are locked)
10|1200 characters needed characters left

4 answers: sort voted first

Indexes that are less than 8 pages in size will be stored on mixed extents within the system. You can't defrag them. In fact, trying to defrag them can even cause fragmentation to increase, but this isn't harmful since the number of pages is so small.

As a general rule, I'd make sure that the indexes you're attempting to defrag are least about 100 pages. The Microsoft recommendation is above 1000 pages.

Since you're using the Maintenance Wizard, I don't think you can filter for page size. But just don't worry about it for the small indexes.

more ▼

answered Jan 11 '12 at 08:50 AM

Grant Fritchey gravatar image

Grant Fritchey ♦♦
62.4k 12 20 66

Thanks Grant. :)

Jan 11 '12 at 09:06 AM Zahid
(comments are locked)
10|1200 characters needed characters left

What reason did Microsoft give for the Maintenance Plan not completing?

Are these large or small indexes?

more ▼

answered Jan 11 '12 at 07:59 AM

Kev Riley gravatar image

Kev Riley ♦♦
46.1k 38 43 69

MS did not explain the reason. They are small indexes. also I have tried with SQL command to rebuild index ALTER INDEX ALL ON dbo.TableName REBUILD WITH (FILLFACTOR = 90, ONLINE = ON)

Still, the Fragmentation that is Avg_Fragmentation_in_Percent is 93.

I think If i use wizard then it might de-frag the indexes. But it realy time consuming to rebuild one by one using wizard.

Any idea? Is it the fill factor? As fragmentation is of two types: Internal and External. I think Internal fragmentation has some relation with fillfactor.

Jan 11 '12 at 08:46 AM Zahid
(comments are locked)
10|1200 characters needed characters left

I am not agree with Microsoft Premium Engineers that maintenance plan task can not completely does this de-fragmentation because I also implemented this on so many database and it works fine. Only valid reason of index not de-fragmentation is given by Grant & Kev.

more ▼

answered Jan 11 '12 at 11:11 PM

Amardeep gravatar image

Amardeep
1.3k 71 82 86

(comments are locked)
10|1200 characters needed characters left

Is this bug hitting you: http://support.microsoft.com/kb/2292737 ?

more ▼

answered Jan 12 '12 at 12:20 AM

Wilfred van Dijk gravatar image

Wilfred van Dijk
549 13 18 20

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments



Facebook logo Follow Ask SSC on Facebook
Find Ask SSC on Google+
linkedin logo Find us on LinkedIn

Topics:

x111
x18

asked: Jan 11 '12 at 07:56 AM

Seen: 543 times

Last Updated: Jan 11 '12 at 08:51 AM

Copyright © 2002-2012 Simple Talk Publishing. All Rights Reserved. If you have any queries, please contact the site administrators.
Ask SQL Server Central is a community service provided by Red Gate.