SQL Server Check

Auto create statistics

This is one of many SQL Server checks performed by our free sp_Check tools.

Learn More About Our sp_check Tools

Checks Performed

ID
Check
728
auto create stats disabled

What’s the issue?

SQL Server’s query optimizer relies on statistics about the distribution of data in tables and indexes to generate efficient execution plans. The AUTO_CREATE_STATISTICS database option, enabled by default, allows SQL Server to automatically create single column statistics on columns referenced in query predicates when no usable statistics already exist.

This finding indicates that one or more databases have AUTO_CREATE_STATISTICS set to OFF. The setting is sometimes disabled in response to a specific vendor recommendation or as part of an attempt to control statistics management manually, but in most environments leaving it on is the correct choice.

Why is this a problem?

Without auto created statistics, the optimizer has less information to work with when building query plans, which can lead to poor cardinality estimates, inappropriate join types, missing or oversized memory grants, and inefficient execution plans overall. The performance impact is often subtle and inconsistent, since the optimizer falls back to defaults or guesses when statistics are missing, producing plans that may work acceptably for some data distributions and very poorly for others.

The problem is particularly difficult to diagnose because the symptoms appear as general query slowness rather than a specific error. Developers and DBAs may spend significant time tuning queries that would simply run well with the appropriate statistics in place.

Disabling auto create statistics also places the entire burden of statistics management on the team, requiring explicit creation of statistics on every column the optimizer might benefit from. In practice this is rarely done comprehensively, so most queries end up worse off than they would be with the automatic behavior.

What should you do about this?

Identify affected databases by querying sys.databases and reviewing the is_auto_create_stats_on column. For each one, confirm with application owners whether the setting was disabled intentionally for a specific vendor requirement (some applications, particularly older ERP systems, do specify this), or whether it was changed without a clear justification.

In most cases the setting should be enabled with ALTER DATABASE [DatabaseName] SET AUTO_CREATE_STATISTICS ON;. The change takes effect immediately and is non disruptive, since SQL Server simply begins creating statistics as queries reference columns that need them.

If a vendor explicitly requires the setting to remain off, document the requirement and the source so the configuration is not changed inadvertently in the future. Consider whether the vendor’s reasoning still applies, since recommendations from older versions of SQL Server are sometimes carried forward without reassessment.

Pair AUTO_CREATE_STATISTICS with AUTO_UPDATE_STATISTICS enabled so that statistics are kept current as data changes, and consider enabling AUTO_UPDATE_STATISTICS_ASYNC for high concurrency workloads where synchronous updates can cause occasional query stalls.

Read more…

Statistics – SQL Server | Microsoft Learn

Type

Performance

Importance

Medium

sp_Checks