Sample Header Ad - 728x90

IndexOptimize and Empty Statistics

4 votes
1 answer
326 views
A database that I support uses IndexOptimize to maintain indexes and statistics. Auto-update statistics is turned off in this database, so IndexOptimize is solely responsible for updating statistics. Recently, I noticed several empty statistics on tables that have rows. The call to IndexOptimize is below. If I change the @OnlyModifiedStatistics parameter from 'Y' to 'N', it will update those empty statistics. However, it will also cause it to update all statistics, which is not desired. Is there a way to have IndexOptimze only update modified stats AND empty stats on tables with rows?
EXECUTE dbo.IndexOptimize
@Databases = 'USER_DATABASES',
@FragmentationLow = NULL,
@FragmentationMedium = NULL, 
@FragmentationHigh = 'INDEX_REBUILD_ONLINE,INDEX_REBUILD_OFFLINE', 
@FragmentationLevel1 = 2, 
@FragmentationLevel2 = 5, 
@MinNumberOfPages = 0,
@UpdateStatistics = 'ALL',
@OnlyModifiedStatistics = 'Y',
@StatisticsSample = 100,
@Indexes='ALL_INDEXES',
@LogToTable = 'Y',
@DatabaseOrder='DATABASE_SIZE_DESC',
@TimeLimit=61200,
@WaitAtLowPriorityMaxDuration = 5,
@WaitAtLowPriorityAbortAfterWait = 'SELF'
Asked by TurkeyMortgage (143 rep)
Feb 17, 2025, 10:39 PM
Last activity: Feb 18, 2025, 02:09 AM