Estimated Rows vs Actual Rows
-
Estimated Rows: Number of rows SQL Server expects an operator to process. It is calculated using statistics and the cardinality estimator.
-
Actual Rows: Number of rows the operator really processed while executing the query.
Why compare them?
If both values are close, SQL Server’s estimate is generally accurate.
A large difference may cause SQL Server to choose:
-
An unsuitable join type
-
An inefficient access method
-
Too much or too little memory
-
Unnecessary parallelism
-
Sort or hash spills to
tempdb
Common reasons for a mismatch
-
Missing or outdated statistics
-
Parameter sniffing
-
Uneven data distribution
-
Complex predicates or joins
-
Non-SARGable conditions
-
Table variables without useful statistics
Example
Estimated Rows: 10
Actual Rows: 500,000
SQL Server planned for only 10 rows, so it might select Nested Loops when a Hash Join could be more suitable.
Key point
A significant difference between estimated and actual rows indicates a cardinality-estimation problem and should be investigated.