Sql-server – Warning for missing statistics in execution plan

sql serversql server 2014statistics

I have a situation that I can't understand. My SQL Server execution plan tells me that I have missing statistics on the table, but the statistics are already created:

Warning

But if we look at the table, we will see that there is a statistic that has been created automatically:

enter image description here

Can somebody help to understand how it can be?

Auto_Update and Auto_Create statistics is turned on on the current DB.

I am using SQL Server 2014.

Best Answer

The warning does not always correspond to missing single-column statistics.

There is no easy way to precisely determine the exact statistic the optimizer went looking for and did not find in all cases, but it is almost always a multi-column statistic that would provide some correlation information across multiple equality predicates in the query.

Perhaps in your case it corresponds exactly with the predicates in the Filter following the scan where the warning appears.

It would be nice if SQL Server reported all columns for the 'missing statistic' warning, but that is not how it works today, unfortunately.

A certain amount of trial-and-error may be necessary to identify the multi-column statistic you need to create to remove the warning. Note that multi-column statistics cannot be created automatically. Despite the warning, you may or may not find the quality of the estimate improves even if the missing statistic is provided.