哈希桶中行链的平均长度

Microsoft.SQLServer.2016.Monitoring.HashIndexAvgChainLengthMonitor (UnitMonitor)

此监视器检查 SQL 数据库中哈希索引空桶计数和行链的平均长度。

Knowledge Base article:

摘要

此监视器检查此数据库中表的哈希桶中行链的平均长度。由于此监视器是整体标准要求的一部分,如果该设置不符合指定的标准,将生成警报。

配置

这些索引用于高效地访问 SQL Server 表中的数据。指定正确的索引可极大地提高查询性能。如果 empty_bucket_percent 大于空桶百分比阈值,avg_chain_length 大于平均链长阈值,监视器将引发警告警报,因为有太多重复项,使用非聚集索引会更加合适。

外部

请参阅更多详细信息:

Indexes for Memory-Optimized Tables(内存优化表的索引)

可替代参数

名称

说明

默认值

警报优先级

定义警报优先级。

正常

警报严重性

定义警报严重性。

警告

平均链长度阈值

平均链长度阈值,表示哈希桶中行链的平均长度。

100

显示索引计数

根据最佳做法未配置索引的显示计数。

5

空桶百分比阈值

空桶百分比阈值,表示哈希索引中的空桶数。

10

已启用

启用或禁用工作流。

生成警报

定义工作流是否生成警报。

间隔(秒)

运行工作流的重复间隔时间(秒)。

43200

同步时间

使用 24 小时格式指定的同步时间。可以忽略。

 

超时(秒)

指定允许工作流在被关闭并标记为失败之前运行的时间。

300

Element properties:

TargetMicrosoft.SQLServer.2016.DBFileGroupFx
Parent MonitorSystem.Health.ConfigurationState
CategoryConfigurationHealth
EnabledTrue
Alert GenerateTrue
Alert SeverityWarning
Alert PriorityNormal
Alert Auto ResolveTrue
Monitor TypeMicrosoft.SQLServer.2016.Monitoring.HashIndexAvgChainLength.MonitorType
RemotableTrue
AccessibilityPublic
Alert Message
MSSQL 2016: 哈希桶错误中行链的平均长度
在计算机“{2}”上 SQL 实例“{1}”中的数据库“{0}”包含的表中,索引包含太多重复项,使用非聚集索引会更加合适。{3}
RunAsDefault

Source Code:

<UnitMonitor ID="Microsoft.SQLServer.2016.Monitoring.HashIndexAvgChainLengthMonitor" Accessibility="Public" Enabled="true" Target="SQL2016Core!Microsoft.SQLServer.2016.DBFileGroupFx" ParentMonitorID="SystemHealth!System.Health.ConfigurationState" Remotable="true" Priority="Normal" TypeID="Microsoft.SQLServer.2016.Monitoring.HashIndexAvgChainLength.MonitorType" ConfirmDelivery="false">
<Category>ConfigurationHealth</Category>
<AlertSettings AlertMessage="Microsoft.SQLServer.2016.Monitoring.HashIndexAvgChainLengthMonitor.AlertMessage">
<AlertOnState>Warning</AlertOnState>
<AutoResolve>true</AutoResolve>
<AlertPriority>Normal</AlertPriority>
<AlertSeverity>Warning</AlertSeverity>
<AlertParameters>
<AlertParameter1>$Target/Host/Property[Type="SQL2016Core!Microsoft.SQLServer.2016.Database"]/DatabaseName$</AlertParameter1>
<AlertParameter2>$Target/Host/Host/Property[Type="SQL2016Core!Microsoft.SQLServer.2016.ServerRole"]/InstanceName$</AlertParameter2>
<AlertParameter3>$Target/Host/Host/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/NetworkName$</AlertParameter3>
<AlertParameter4>$Data/Context/Property[@Name='Status']$</AlertParameter4>
</AlertParameters>
</AlertSettings>
<OperationalStates>
<OperationalState ID="Success" MonitorTypeStateID="Health" HealthState="Success"/>
<OperationalState ID="Warning" MonitorTypeStateID="Warning" HealthState="Warning"/>
</OperationalStates>
<Configuration>
<ComputerName>$Target/Host/Host/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/NetworkName$</ComputerName>
<SqlInstanceName>$Target/Host/Host/Property[Type="SQL2016Core!Microsoft.SQLServer.2016.ServerRole"]/InstanceName$</SqlInstanceName>
<ConnectionString>$Target/Host/Host/Property[Type="SQL2016Core!Microsoft.SQLServer.2016.DBEngine"]/ConnectionString$</ConnectionString>
<ServiceName>$Target/Host/Host/Property[Type="SQL2016Core!Microsoft.SQLServer.2016.DBEngine"]/ServiceName$</ServiceName>
<DatabaseName>$Target/Host/Property[Type="SQL2016Core!Microsoft.SQLServer.2016.Database"]/DatabaseName$</DatabaseName>
<IntervalSeconds>43200</IntervalSeconds>
<TimeoutSeconds>300</TimeoutSeconds>
<SyncTime/>
<EmptyBucketPercentThreshold>10</EmptyBucketPercentThreshold>
<AvgChainLengthThreshold>100</AvgChainLengthThreshold>
<ErrorTopLines>5</ErrorTopLines>
</Configuration>
</UnitMonitor>