Statistics shown on an orders table of 10,000 rows: the histogram lists Saffron 5 rows, Spice 995 and Tea 9,000, and the optimizer uses an Index Seek with a Key Lookup for Saffron and a Clustered Index Scan for Tea

SQL Statistics: How SQL Server Estimates Row Counts

SQL statistics are small summaries of your data that tell the optimizer how many rows a query will return. This post builds an orders table with one rare value and one common value, reads the histogram, compares estimated and actual rows in the plans, and shows a stale statistic fixed with UPDATE STATISTICS. Every result comes from SQL Server 2025.

Read More