FIX: A small number of rows are sampled in SQL Server when table statistics are updated automatically or together with specified sampling rate

Applies to: SQL Server 2008 R2 Service Pack 2SQL Server 2008 R2 DatacenterSQL Server 2008 R2 Developer

Symptoms


Assume that you have a table that has statistics on columns that correspond to a prefix of the key of the clustered or covering non-clustered index. There are some non-covering indexes for which this condition is not true. When the statistics of the table are updated automatically or manually with a specified sampling rate, a significantly smaller number of rows are sampledfrom the sampling rate than expected. This results in non-representative statistics, and inefficient query plans may be used for the queries that use the statistics.

Resolution


The issue was first fixed in the following cumulative update of SQL Server. After you apply the fix, you have to enable trace flag 4199 to make the hotfix work.

Cumulative Update 1 for SQL Server 2014

Cumulative Update 8 for SQL Server 2012 SP1

Cumulative Update 10 for SQL Server 2008 R2 SP2

Workaround


To work around the issue, manually update the statistics together with the FULLSCAN or SAMPLE option as well as with a higher sampling rate.

Status


Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.