Tag:Missing

  • SQL statement to realize query and create missing index automatically

    Time:2021-4-3

    SELECT migs.avg_total_user_cost*(migs.avg_user_impact/ 100.0) *(migs.user_seeks + migs.user_scans) ASimprovement_measure, ‘CREATE INDEX[missing_index_’ + CONVERT(varchar, mig.index_group_handle) + ‘_’ + CONVERT(varchar, mid.index_handle) + ‘_’ + LEFT(PARSENAME(mid.statement, 1), 32) + ‘]’ + ‘ ON ‘ + mid.statement + ‘ (‘ + ISNULL(mid.equality_columns,”) + CASE WHEN mid.equality_columns IS NOT NULL AND mid.inequality_columnsIS NOT NULL THEN ‘,’ ELSE ” END + ISNULL(mid.inequality_columns, ”) […]