SA0131 : High number of estimated rows found in execution plan |
![]() |
High estimated row counts in execution plans may indicate incorrect join conditions, outdated statistics, or missing/unused indexes, leading to performance issues.

This problem pertains to queries within stored procedures, views, and functions that show a high number of estimated rows in their execution plans. Such estimates can lead to inefficient execution strategies in SQL Server, potentially degrading performance.
For example:
1-- Example of a query with high estimated rows 2SELECT * FROM Orders WHERE OrderDate > '2023-01-01';
In this example, if the OrderDate column is not indexed properly, SQL Server might estimate a high number of rows, which can lead to suboptimal query execution plans, such as choosing a table scan over an index seek.
-
Leads to inefficient use of resources by potentially triggering full table scans.
-
Could cause increased IO operations, leading to slower query performance.

Optimize SQL queries with high estimated row counts in execution plans to improve performance and resource usage.
Follow these steps to address the issue:
-
Review the query’s filtering conditions, particularly in the WHERE clause, to ensure they reflect accurate and optimal conditions for the dataset. For instance, verify the join conditions are correct.
-
Update the statistics for the tables involved in the query to ensure that SQL Server has the most recent data distribution information. Use the UPDATE STATISTICS command for this purpose:
-
Check if appropriate indexes are present on columns used in filtering conditions like WHERE clauses or join conditions. If missing, consider adding indexes to enhance execution plans, such as using CREATE INDEX.
-
Evaluate the execution plan of the query to determine if any operators, like table scans, are suboptimal. Use tools like SQL Server Management Studio to inspect the execution plan’s graphical representation.
For example:
1-- Example of corrected query with an index 2CREATE INDEX idx_OrderDate ON Orders(OrderDate); 3 4-- Updated statistics 5UPDATE STATISTICS Orders; 6 7-- Optimized query 8SELECT * FROM Orders WHERE OrderDate > '2023-01-01';

The rule has a Batch scope and is applied only on the SQL script.

Name | Description | Default Value |
---|---|---|
RowLimit |
The parameter specifies the minimum cost in percent of any of the available operator in order to be included in the results.Value of equal or greater of 100 will exclude the operator from the results. |
100000 |

The rule requires SQL Connection. If there is no connection provided, the rule will be skipped during analysis.


Design Rules, Bugs

There is no additional info for this rule.

SQL
1CREATE PROCEDURE [dbo].[testsp_SA0131] 2 @ManagerID [int] 3AS 4BEGIN 5 SET NOCOUNT ON; 6 7SELECT 8 e.[BusinessEntityID] 9 ,p.[Title] 10 ,p.[FirstName] 11 ,p.[MiddleName] 12 ,p.[LastName] 13 ,p.[Suffix] 14 ,e.[JobTitle] 15 ,p.[EmailPromotion] 16 ,a.[AddressLine1] 17 ,a.[AddressLine2] 18 ,a.[City] 19 ,a.[PostalCode] 20 --,cr.[Name] AS [CountryRegionName] 21 ,p.[AdditionalContactInfo] 22FROM [HumanResources].[Employee] e 23 INNER JOIN [Person].[Person] p 24 ON p.BusinessEntityID = e.[BusinessEntityID] 25 INNER JOIN [Person].[BusinessEntityAddress] bea 26 ON bea.ModifiedDate < GETDATE() 27 INNER JOIN [Person].[Address] a 28 ON a.[AddressID] = bea.[AddressID] 29END; |

Message | Line | Column | |
---|---|---|---|
1 | SA0131 : High number of estimated rows found in the statement execution plan. Estimated Rows:1700690, Operator:Hash Match | 5 | 4 |
