February 17, 2020 at 7:06 pm
This is the link used for updating statistics
https://www.brentozar.com/archive/2016/04/updating-statistics-ola-hallengrens-scripts/
Thanks.
February 17, 2020 at 9:29 pm
John
Jeff Moden wrote:John Mitchell-245523 wrote:That's not (just) updating statistics - it's index maintenance. When you rebuild an index, you should plan to have at least the same amount of free space in your database as the size of the index, and possibly more. If you don't, the data file is likely to have to grow.
John
It's probably not due to index maintenance. See the following setting in the code above...
@OnlyModifiedStatistics = 'Y',
Mmmm... the parameter is @OnlyModifiedStatistics, not @OnlyModifyStatistics. As I understand it, all that means is that statistics are only updated if there have been any modifications to the data. It doesn't mean that indexes are left untouched. This is how the documentation suggests doing statistics only:
EXECUTE dbo.IndexOptimize
@Databases = 'USER_DATABASES',
@FragmentationLow = NULL,
@FragmentationMedium = NULL,
@FragmentationHigh = NULL,
@UpdateStatistics = 'ALL'John
Thanks for the catch, John.
--Jeff Moden
Change is inevitable... Change for the better is not.
February 17, 2020 at 9:45 pm
Sorry the confusion.
So, I have to modify SQL Agent job to execute :
EXECUTE dbo.IndexOptimize
@databases = 'USER_DATABASES',
@FragmentationLow = NULL,
@FragmentationMedium = NULL,
@FragmentationHigh = NULL,
@UpdateStatistics = 'ALL',
@LogToTable = 'Y'
INSTEAD of
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,
@UpdateStatistics = 'ALL',
@OnlyModifiedStatistics = 'Y',
@LogToTable = 'Y'
February 18, 2020 at 9:13 am
No - that's just a sidebar. That's what you would do if you wanted to update statistics only, and not rebuild your indexes. I'm sure Jeff will explain the benefits of not maintaining indexes at all, but that's a slightly different matter.
John
Viewing 4 posts - 16 through 18 (of 18 total)
You must be logged in to reply to this topic. Login to reply