• 索引缺失与创建


     
     
     
     

      SELECT TOP 100
                [Total Cost] = ROUND(avg_total_user_cost * avg_user_impact
                                     * ( user_seeks + user_scans ), 0) ,
                user_seeks ,
                user_scans ,
                avg_total_user_cost ,
                avg_user_impact ,
                TableName = statement ,
                [EqualityUsage] = equality_columns ,
                [InequalityUsage] = inequality_columns ,
                [Include Cloumns] = included_columns ,
                'create index IX_' + PARSENAME(statement, 1) + '_'
                + REPLACE(REPLACE(REPLACE(equality_columns, '[', ''), ']', ''),
                          ',', '') + '  on ' + PARSENAME(statement, 1) + ' ('
                + REPLACE(REPLACE(REPLACE(equality_columns, '[', ''), ']', ''),
                          ',', '') + CASE WHEN included_columns IS  NULL THEN ''
                                          ELSE ') INCLUDE (' + included_columns
                                               + ')'
                                     END
      FROM      sys.dm_db_missing_index_groups g
                INNER JOIN sys.dm_db_missing_index_group_stats s ON s.group_handle = g.index_group_handle
                INNER JOIN sys.dm_db_missing_index_details d ON d.index_handle = g.index_handle
      WHERE     1 = 1
                AND statement LIKE '%SCT%'
      ORDER BY  [Total Cost] DESC

     
     

  • 相关阅读:
    20220613 08:00:02
    20220617 08:00:01
    20220619 08:00:02
    vue3自定义指令的使用
    React中setState方法详细讲解
    js中数组reduce的使用原来这么简单
    Ant Design Vue栅格Grid的使用
    React中render Props模式
    CVE202230190 Follina Office RCE分析【附自定义word钓鱼模板POC】
    夏令营随笔
  • 原文地址:https://www.cnblogs.com/qanholas/p/2438924.html
Copyright © 2020-2023  润新知