sql-server-maintenance-solution icon indicating copy to clipboard operation
sql-server-maintenance-solution copied to clipboard

Not all indexes get rebuilt or reogranized

Open alenloncaric opened this issue 5 years ago • 4 comments

Why when some indexes have 99% fragmentation the index optimize script doesnt rebuild it ? It is a WEB edition meaning no online rebuild, would this be the issue ?

With kind regards, Alen

alenloncaric avatar Sep 24 '20 13:09 alenloncaric

Hi Alen,

Could you please provide the arguments you used when this behavior occurred? It is difficult to answer your question without knowing more. To give you just one example, the default value for the parameter "MinNumberOfPages" is 1000, which means that indexes with fewer than 1000 pages will be skipped.

Best, Danilo

CrazySwimmer avatar Oct 04 '20 12:10 CrazySwimmer

Hi,

I might be having the same problem. I ran this very useful tool against a database with 100's of tables to Reorganise all the fragmented indexes. It appears to have skipped all the Primary Key indexes which were fragmented. It did every other index. I ran the following parameters, on Standard Edition.

EXECUTE dbo.IndexOptimize @Databases = 'ADatabaseName', @FragmentationLow = NULL, @FragmentationMedium = Null, @FragmentationHigh = 'INDEX_REORGANIZE', @FragmentationLevel1 = 5, @FragmentationLevel2 = 50, @LogToTable = 'Y'

From the limited investigation I did, it appears to be all Primary Key were ignored. Will keep investigating.

Running the Reorganise ALL manually on each table, defrags them, would be super awesome, if this tool did too.

Thanks.

Draven2001 avatar Oct 12 '20 13:10 Draven2001

MinNumberofPages

Yup this was the key. Thanks.

Draven2001 avatar Oct 12 '20 13:10 Draven2001

@alenloncaric, were you able to get this working using @MinNumberOfPages = 0?

olahallengren avatar Feb 08 '25 19:02 olahallengren

I'm closing this issue for now. If you encounter the problem again, feel free to comment and I'll reopen it.

olahallengren avatar Jul 20 '25 01:07 olahallengren