Sql-server – Ola Hallengrens code for Index Optimization – Clarifications

indexola-hallengrensql server 2014

I am trying to deploy Ola Hallengrens code for Index Optimization in our PROD environment.

What is the difference between using USER_DATABASES and AVAILABILITY_GROUP_DATABASES in the place of @Databases in below code .

Also I was going through the blogs and read :

Ola Hallengrens code for Index Optimization is meant to defragment only with page count more than 1000.

When I execute below command it updates only statistics not rebuild indexes –

Does this mean I am good with fragmentation , not to worry much about it as my end users does not complaint any thing about slow response or bad performance from Database end .

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

Best Answer

The difference between user_databases & availability_group_databases is that when specifying user_databases you will optimize every user database (also the ones in the AG group) if you specify availability_group_databases you will only optimize the indexes of databases inside an availability group.

If you do not have tables with fragmentation above 1000 pages, this will not hurt your SQL Server performance. I recommend you also read this post from Brent Ozar. https://www.brentozar.com/archive/2012/08/sql-server-index-fragmentation/