Symptoms

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.

Resolution

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

Cumulative Update 6 for SQL Server 2014 Service Pack 1 Cumulative Update 1 for SQL Server 2016 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.

Each new cumulative update for SQL Server contains all the hotfixes and all the security fixes that were included with the previous cumulative update. Check out the latest cumulative updates for SQL Server:

Latest cumulative update for SQL Server 2014 Latest cumulative update for SQL Server 2016

Status

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

References

Learn about the terminology Microsoft uses to describe software updates.

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.