I run the Ola Hallengren scripts on all of my servers for index and statistics maintenance. When I look through the command log table, I notice long periods of time between a command ending, and the next command starting. Sometimes this gap is over an hour.
Does anyone else observe this on their systems? Is there something I can do to shorten the (I'm guessing) discovery time between items to maintain? Below is the parameter set I'm running them with.
sqlcmd -E -S $(ESCAPE_SQUOTE(SRVR)) -d master -Q "EXECUTE [dbo].[IndexOptimize] @Databases = 'USER_DATABASES', @LogToTable = 'Y', @FragmentationLow = NULL, @FragmentationMedium = 'INDEX_REORGANIZE,INDEX_REBUILD_ONLINE,INDEX_REBUILD_OFFLINE', @FragmentationHigh = 'INDEX_REBUILD_ONLINE,INDEX_REBUILD_OFFLINE', @FragmentationLevel1 = 50, @FragmentationLevel2 = 80, @UpdateStatistics = 'ALL', @OnlyModifiedStatistics = 'Y' " -b
So when I run this:
SELECT DATEDIFF(MINUTE, cl.StartTime, cl.EndTime) , * FROM master.dbo.CommandLog AS cl WHERE cl.StartTime > '2014-12-13' ORDER BY cl.ID
I see this: