SQL执行计划显示“实际行数”,大于表大小

时间:2022-10-25 00:07:07

I have an execution plan for a fairly complex join which shows an index seek being performed on a table with the "Actual Number of Rows" reading ~70,000, when there are in fact only ~600 rows in the table in total (the estimated number of rows is only 127).

我有一个相当复杂的连接的执行计划,它显示在一个表上执行索引查找,其中“实际行数”读数为~70,000,而实际上表中总共只有约600行(估计数量)行只有127)。

Note that all of the statistics are up to date and the input parameters to the query are exactly the same as the parameters that were entered when the proc was compiled.

请注意,所有统计信息都是最新的,查询的输入参数与编译proc时输入的参数完全相同。

Why is the actual number of rows so high, and what does the number "Actual Number of Rows" really mean?

为什么实际行数如此之高,“实际行数”的实际含义是什么?

My only theory is that high number of rows is related to the nested loops, and that this index seek is being executed a number of times - the "Actual Number of Rows" really represents the total number of rows over all executions. If this is the case is the estimated number of rows also meant to be the total number of rows over all executions?

我唯一的理论是,大量的行与嵌套循环有关,而且这个索引查找正在被执行多次 - “实际行数”实际上代表了所有执行的总行数。如果是这种情况,估计的行数也意味着所有执行的总行数?

2 个解决方案

#1


10  

ActualRows counts the number of times GetNext() was called on a physical operator.

ActualRows计算在物理运算符上调用GetNext()的次数。

You should also look at the ActualRebinds, ActualRewinds and ActualEndOfScans to get an idea how many times the inner loop was re-evaluated:

您还应该查看ActualRebinds,ActualRewinds和ActualEndOfScans以了解重新评估内部循环的次数:

A rebind means that one or more of the correlated parameters of the join changed and the inner side must be reevaluated. A rewind means that none of the correlated parameters changed and the prior inner result set may be reused.

重新绑定意味着连接的一个或多个相关参数已更改,并且必须重新评估内侧。倒带意味着没有相关参数改变,并且可以重用先前的内部结果集。

#2


3  

the actual number of rows values is the result of all processed values for that node in the exec plan. so yes it takes into account the nested loops join.

实际行数值是exec计划中该节点的所有已处理值的结果。所以是的,它考虑了嵌套循环连接。

#1


10  

ActualRows counts the number of times GetNext() was called on a physical operator.

ActualRows计算在物理运算符上调用GetNext()的次数。

You should also look at the ActualRebinds, ActualRewinds and ActualEndOfScans to get an idea how many times the inner loop was re-evaluated:

您还应该查看ActualRebinds,ActualRewinds和ActualEndOfScans以了解重新评估内部循环的次数:

A rebind means that one or more of the correlated parameters of the join changed and the inner side must be reevaluated. A rewind means that none of the correlated parameters changed and the prior inner result set may be reused.

重新绑定意味着连接的一个或多个相关参数已更改,并且必须重新评估内侧。倒带意味着没有相关参数改变,并且可以重用先前的内部结果集。

#2


3  

the actual number of rows values is the result of all processed values for that node in the exec plan. so yes it takes into account the nested loops join.

实际行数值是exec计划中该节点的所有已处理值的结果。所以是的,它考虑了嵌套循环连接。