SQL Server: Enable Auto Create and Auto Update Statistics

In the previous article, I have shared the importance of SQL Server Statistics and why it is important for the query optimizer.

SQL Server: The Importance of Statistics and Why It is important

To create and update statistics is very important for Query Optimizer to choose best optimized execution plan.

In this post, I am sharing script to enable and disable auto_create and auto_update of Statistics on a Database.

Auto Create Statistics:

If statistics are not already available, Query Optimizer creates statistics on individual columns.
The name of the auto-created statistics includes the column name and the object ID in hexadecimal format: _WA_Sys__.

Auto Update Statistics:

If Query Optimizer finds that Statistics is out of date, it updates require statistics automatically.
It takes decisions base on old number record count and current column modification counter.
The default option is ON.
The outdated statistics can cause a lot of performance issues so it is recommended to enable it.

Auto Update Statistics Asynchronously:

If you enable this option, the Query Optimizer will run the query first and update the outdated statistics afterwards.
When you set this option to OFF, the Query Optimizer will update the outdated statistics before compiling the query.

Anvesh Patel

Leave a Reply

Be the First to Comment!

Notify of