FIX: Estimated number of rows is calculated incorrectly for a predicate involving a unique GUID column in SQL Server 2014 or 2016


Consider the following scenario:
  • You have a query that uses a non-equality predicate on a unique GUID column in SQL Server 2014 or 2016.
  • The statistics are updated by using default sampling. Or, new rows are inserted into the table after the last statistics update.
  • SQL Server uses the New Cardinality Estimator in which the database compatibility mode is set to 120.
  • The GUID values are non-uniformly distributed across the table.

In this scenario when you run the query, you may experience poor performance because of incorrectly estimated number of rows for the predicate in the query plan.


This problem was first fixed in the following cumulative update for SQL Server:

After you install this cumulative update package, you have to enable trace flag 4199. To do this, you can add the -T4199 startup parameter. Or, you can use the dbcc traceon(4199) statement for a specific session.
About cumulative updates for SQL Server
About cumulative updates for SQL Server


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


Learn about the terminology Microsoft uses to describe software updates.

ID articol: 3150152 - Ultima examinare: 25 iul. 2016 - Revizie: 1