【问题标题】:Index hints with SSMS for Azure SQL DatabaseAzure SQL 数据库的 SSMS 索引提示
【发布时间】:2020-04-10 16:09:58
【问题描述】:

在传统 SQL Serer 的 SSMS 中,您会在实际执行计划中获得缺少索引的提示。 (它显示create indexstatements。)

但是,当连接到 Azure SQL 数据库时,似乎缺少此功能。是否有其他方法可以获取有关丢失索引和加快查询的提示?

【问题讨论】:

    标签: azure-sql-database ssms


    【解决方案1】:

    您可以使用sys.dm_db_missing_index_details (Transact-SQL) 获取丢失索引的详细信息:返回有关丢失索引的详细信息,不包括空间索引。

    有 3 个主要 DMV 提供有关缺失索引的信息:

    --Returns detailed information about missing indexes
    SELECT * FROM sys.dm_db_missing_index_details
    
    --Returns information about what missing indexes are contained in a specific missing index group
    SELECT * FROM  sys.dm_db_missing_index_groups
    
    --Returns summary information about groups of missing indexes
    SELECT * FROM sys.dm_db_missing_index_group_stats
    

    更多细节可以参考:

    1. sys.dm_db_missing_index_groups (Transact-SQL):此 DMV 返回有关特定索引组中缺少的索引的信息,空间索引除外。
    2. sys.dm_db_missing_index_group_stats (Transact-SQL):返回有关缺失索引组的摘要信息,不包括空间索引。

    其他参考:Identifying Missing Indexes in SQL Server.

    希望这会有所帮助。

    【讨论】:

      猜你喜欢
      • 2016-01-15
      • 1970-01-01
      • 2019-11-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-11-26
      • 1970-01-01
      相关资源
      最近更新 更多