sql-server – 什么是“部分匹配索引”?

我正在尝试了解有关sql Server 2016中引入的“外键引用检查”查询计划运算符的更多信息.那里没有很多关于它的信息.微软宣布它为 here,我在博客上发表了关于 here的信息.通过从父表中删除一行,包含254个或更多的传入外键引用,可以看到新的运算符: dbfiddle link.

运算符详细信息中显示三种不同的计数:

>外键引用Count是传入外键的数量.
>没有匹配的索引Count是没有合适索引的传入外键的数量.验证更新或删除的表不会违反该约束将需要扫描子表.
>我不知道Count所代表的部分匹配索引.

在这种情况下,什么是部分匹配索引?我无法获得以下任何一项工作:

>过滤的索引
>将外键列作为索引的INCLUDE列
>将外键列作为第二个键列的索引
>多列外键的单列索引
>创建多个覆盖索引以启用多列外键的“索引连接”计划

Dan Guzman指出,即使索引键的顺序与外键列的顺序不同,多列外键也可以匹配索引.他的代码here,以防有人能够使用它作为起点来找出有关部分匹配索引的更多信息.

解决方法

我和那些比我更聪明的人交谈过,我们很快就会记录下来.

在此期间的实际定义是:

PartialMatchingIndexCount reflects the number of references that Could
be checked using index seeks,but the index key does not cover all the
columns being checked. For example,the corresponding
ForeignKeyReferenceCheck elements contain both a Seek Predicates and a
Predicate element.

此外:

If this number is greater than 0,there is a potential performance issue,in case the partial matches result in large numbers of rows.

相关文章

SELECT a.*,b.dp_name,c.pa_name,fm_name=(CASE WHEN a.fm_n...
if not exists(select name from syscolumns where name=&am...
select a.*,pano=a.pa_no,b.pa_name,f.dp_name,e.fw_state_n...
要在 SQL Server 2019 中设置定时自动重启,可以使用 Window...
您收到的错误消息表明数据库 'EastRiver' 的...
首先我需要查询出需要使用SQL Server Profiler跟踪的数据库标...