5

I have downloaded Ola Hallengren's script and deployed to master database. I run it using the below...

EXECUTE dbo.IndexOptimize
 @Databases = 'USER_DATABASES',
 @FragmentationLow = NULL,
 @FragmentationMedium = 'INDEX_REORGANIZE,INDEX_REBUILD_ONLINE,INDEX_REBUILD_OFFLINE',
 @FragmentationHigh = 'INDEX_REBUILD_ONLINE,INDEX_REBUILD_OFFLINE',
 @FragmentationLevel1 = 5,
 @FragmentationLevel2 = 30

I get this output in SSMS but the Indexes have not been rebuilt. Fragmentation is still very high. Am I missing something?

Date and time: 2015-03-01 14:07:24
Server: TestSvr
Version: 10.50.2500.0
Edition: Standard Edition (64-bit)
Procedure: [master].[dbo].[IndexOptimize]
Parameters: @Databases = 'USER_DATABASES', 
@FragmentationLow = NULL, 
@FragmentationMedium = 'INDEX_REORGANIZE,INDEX_REBUILD_ONLINE,INDEX_REBUILD_OFFLINE',     
@FragmentationHigh = 'INDEX_REBUILD_ONLINE,INDEX_REBUILD_OFFLINE', 
@FragmentationLevel1 = 5, 
@FragmentationLevel2 = 30, 
@PageCountLevel = 1000, @SortInTempdb = 'N', 
@MaxDOP = NULL, @FillFactor = NULL, @PadIndex = NULL, 
@LOBCompaction = 'Y', @UpdateStatistics = NULL, 
@OnlyModifiedStatistics = 'N', @StatisticsSample = NULL, 
@StatisticsResample = 'N', @PartitionLevel = 'Y', 
@MSShippedObjects = 'N', 
@Indexes = NULL, @TimeLimit = NULL, @Delay = NULL, 
@WaitAtLowPriorityMaxDuration = NULL, 
@WaitAtLowPriorityAbortAfterWait = NULL, @LockTimeout = NULL, 
@LogToTable = 'N', @Execute = 'Y'
Source: https://ola.hallengren.com

Date and time: 2015-03-01 14:07:24
Database: [TestData]
Status: ONLINE
Standby: No
Updateability: READ_WRITE
User access: MULTI_USER
Is accessible: Yes
Recovery model: SIMPLE

enter image description here

Aaron Bertrand
  • 181,950
  • 28
  • 405
  • 624
K09
  • 1,454
  • 13
  • 39
  • 61

1 Answers1

17

Your index only has 679 pages. Ola's solution is set to ignore indexes with less than 1000 pages (see the @PageCountLevel parameter). You can override that so that it cares about indexes with fewer than 1000 pages, but why? Wasted effort IMHO.

I would stop worrying about small tables like this - let Ola's solution do its job, and worry about fragmentation when you can actually prove it is causing a tangible performance problem for a specific index. "Fragmentation is high" is not a problem on its own.

Aaron Bertrand
  • 181,950
  • 28
  • 405
  • 624