РЕОРГАНИЗАЦИЯ ИНДЕКСОВ MS SQL

РЕОРГАНИЗАЦИЯ ИНДЕКСОВ MS SQL

Содержание настоящей статьи

sql реорганизация индексов

SQL Server Index Fragmentation on SSD. Фрагментация индексов и SSD диск


Knowledge Base

Параметры указывают операции с индексом, имеющим средний уровень фрагментации. Данный параметр имеет схожие переменные с FragmentationLow

Применить процент свободного места, который коэффициент заполнения указывает на страницы промежуточного уровня индекса.

Обновлять статистику только в том случае, если какие-либо строки были изменены с момента последнего обновления статистики

IndexOptimize проверяет is_ms_shipped в sys.objects, чтобы определить, был ли объект создан внутренним компонентом SQL Server.

Параметр WaitAtLowPriorityMaxDuration использует параметр SQL Server WAIT_AT_LOW_PRIORITY и MAX_DURATION команды ALTER INDEX.

Действие, которое будет выполняться после операции ожидания блокировки с низким приоритетом на перестроение индекса online

Устанавливет время в секундах, чтобы команда ожидала освобождения блокировки. По умолчанию время не ограничено.

Выполнить команды. По умолчанию команды выполняются нормально. Если этот параметр установлен в N, то команды только выводятся на экран.

EXECUTE dbo.IndexOptimize
@Databases = ‘USER_DATABASES’,
@FragmentationLow = NULL,
@FragmentationMedium = NULL,
@FragmentationHigh = NULL,
@UpdateStatistics = ‘ALL’

Factors to consider while Rebuild

In above example, We can see 99 % of average fragmentation it means index is having more logical fragmentation(Unordering of pages is more).

But Avg_Fragmentation_In_Percent value says only logical fragmentation not amount of space which is not used in index.

Can we consider both Avg_fragmentation_in_percent and Avg_page_space_used_in_percent values for choosing Rebuild an index or Reorganize an index?

Any one please suggest me the exact parameters to be consider for choosing Rebuild or Re-Organize of an index?

I wouldn’t be too concerned about the Avg_page_space_used_in_percent column with regards to deciding whether to Rebuild or Reorganize and index.

According to Reorganize and Rebuild Indexes, both Rebuild and Reorganize honor the FILLFACTOR for the index and try to fill up the pages accordingly.

So, immediately after a Rebuild or Reorganize, you should see Avg_page_space_used_in_percent fairly close the the FILLFACTOR of the index.