Statistics are the single most critical component of query performance. They are the “map” that the SQL Server Query Optimizer uses to navigate your data. If the map is wrong, the engine gets lost, and your application performance tanks. In this guide, I will walk you through exactly how to update statistics on a table in SQL Server.
Update Stats on Table SQL Server
What Are SQL Server Statistics?
Before we run the commands, we need to understand what we are updating. We will move beyond the basic commands and dive into the strategies.
Statistics are binary large objects (BLOBs) that contain a histogram describing the distribution of values in one or more columns. When you submit a query, the optimizer checks these histograms to estimate how many rows will be returned (“Cardinality Estimation”).
- Accurate Stats: The optimizer picks the right index and the right join type (e.g., Hash Match vs. Nested Loop).
- Stale Stats: The optimizer guesses wrong, potentially causing massive memory grants or tempdb spills.
How to Check When Statistics Were Last Updated
Before you blindly run an update, you should verify if it is necessary. I use this query daily to audit tables in my environments. It tells you exactly how “fresh” your data map is.
SQL
SELECT
OBJECT_NAME(stat.object_id) AS TableName,
stat.name AS StatisticsName,
sp.last_updated AS LastUpdated,
sp.rows AS TotalRows,
sp.rows_sampled AS RowsSampled,
sp.unfiltered_rows AS UnfilteredRows,
sp.modification_counter AS RowsChanged
FROM sys.stats AS stat
CROSS APPLY sys.dm_db_stats_properties(stat.object_id, stat.stats_id) AS sp
WHERE OBJECT_NAME(stat.object_id) = 'SalesOrderHeader'; -- Replace with your table
Key Columns to Watch
- LastUpdated: If this date is from 2023 and you are reading this in 2025, you have a problem.
- RowsChanged: This counts the number of modifications (INSERT/UPDATE/DELETE) since the last update.
- RowsSampled: If you have 10 million rows but only 1% were sampled, your histogram might miss outliers.
Method 1: The UPDATE STATISTICS Command (Recommended)
It allows you to target a specific table or index with granular control. This is the method I recommend for 95% of production scenarios.
Basic Syntax
To update all statistics on a specific table using the default sampling rate:
SQL
UPDATE STATISTICS Sales;After executing the query above, I received the expected output, as shown in the screenshot below.

Using FULLSCAN for Maximum Accuracy
If you have a table that is critical for reporting (e.g., a nightly batch process for a CEO dashboard), default sampling might not be enough. You can force SQL Server to read every single row to build the histogram.
Warning: This is resource-intensive. Do not run this on a 1TB table during business hours.
SQL
UPDATE STATISTICS Sales
WITH FULLSCAN;After executing the query above, I received the expected output, as shown in the screenshot below.

Using SAMPLE for Large Tables
For massive tables where a full scan takes too long, you can define a specific percentage.
SQL
UPDATE STATISTICS Sales.LogisticsTracking
WITH SAMPLE 20 PERCENT;After executing the query above, I received the expected output, as shown in the screenshot below.

Method 2: sp_updatestats
You will often see tutorials recommending sp_updatestats. This stored procedure runs against the entire database.
My Professional Advice: Avoid using this in production unless you are doing a full weekend maintenance window.
- Pros: It checks the
rowmodctr(row modification counter) and only updates stats that have changed. - Cons: It uses the default sampling rate, which is often too low for large tables. It can also trigger massive recompilation storms, where every query plan in your cache is invalidated at once, causing a sudden CPU spike.
SQL
-- Updates statistics for all tables in the current database
EXEC sp_updatestats;After executing the query above, I received the expected output, as shown in the screenshot below.

Advanced Options: NORECOMPUTE and RESAMPL
To truly master statistics, you need to understand the optional flags.
NORECOMPUTE
By default, SQL Server has an “Auto Update Statistics” feature. When a certain threshold of data changes (usually 20% + 500 rows), the server automatically triggers an update.
Sometimes, you don’t want this. For example, if you just ran a manual FULLSCAN on a Saturday, you don’t want SQL Server to overwrite your perfect stats with a quick, low-quality sample on Monday morning just because you hit the threshold.
SQL
UPDATE STATISTICS Sales.SalesOrderHeader
WITH FULLSCAN, NORECOMPUTE;Note: This disables future auto-updates for this specific statistic. Use with caution.
After executing the query above, I received the expected output, as shown in the screenshot below.

RESAMPLE
This option tells SQL Server to update the statistic using the last known sampling rate. If you previously updated with FULLSCAN (100%), RESAMPLE will use 100% again. If you used 10%, it will use 10%.
SQL
UPDATE STATISTICS Sales.SalesOrderHeader
WITH RESAMPLE;After executing the query above, I received the expected output, as shown in the screenshot below.

Comparison of Update Strategies
| Feature | UPDATE STATISTICS | sp_updatestats | Auto-Update (System) |
| Scope | Single Table or Index | Entire Database | Single Statistic (Triggered by query) |
| Control | High (Fullscan, Sample %) | Low (Default only) | None (System determined) |
| Performance Impact | Variable (You control it) | High (Database-wide) | Minimal (Background process) |
| Best Use Case | Critical tables, Nightly jobs | Dev/Test environments | General maintenance |
When Should You Update Statistics
You do not need to update statistics every five minutes. Over-updating is a common mistake that wastes CPU and I/O. Here is my rule of thumb for US enterprise clients:
- After Bulk Loads: If you just imported 500,000 rows into a table that had 100,000 rows, update stats immediately.
- After Index Reorganization: Rebuilding an index (
REBUILD) updates stats automatically withFULLSCAN. Reorganizing (REORGANIZE) does not. If you only reorg, you must manually update stats. - When Troubleshooting Performance: If a query suddenly goes slow on a Tuesday afternoon, checking/updating stats is step one in triage.
- Weekly Maintenance: For most OLTP tables, a weekly update job (usually on Sunday at 2 AM EST) is sufficient.
Conclusion
Updating statistics is not just a maintenance task; it is a performance tuning strategy. By controlling when and how your statistics are calculated, you ensure that the SQL Server optimizer always has the best possible map of your data.
Stop relying on auto-updates for your critical tables. Script out targeted UPDATE STATISTICS commands for your high-volume tables, and watch your query execution times drop.
You may also like the following articles:
- How to Check If CDC Is Enabled on a Table in SQL Server
- SQL Server Change Table Schema
- SQL Server Table Last Modified Date
- How to Create Index on Temp Table in SQL Server
- SQL Server In Memory Tables
After working for more than 15 years in the Software field, especially in Microsoft technologies, I have decided to share my expert knowledge of SQL Server. Check out all the SQL Server and related database tutorials I have shared here. Most of the readers are from countries like the United States of America, the United Kingdom, New Zealand, Australia, Canada, etc. I am also a Microsoft MVP. Check out more here.