In the current cardinality estimation model of Microsoft SQL Server 2016, uniqueness isn't explained when histograms are scaled. This may cause unique columns having a frequency that's greater than 1. The method for dealing with this in RTM is to ignore the histogram completely on UNIQUE columns. This may cause poor estimates when the distribution of the column is non-uniform.
After this update is installed, the histogram will be used properly if it has all step values within 10% of unique.
- This change will be enabled only if trace flag 4199 is enabled, if the database scope of database configuration QUERY_OPTIMIZER_HOTFIXES is set to ON, or if query hint ENABLE_QUERY_OPTIMIZER_HOTFIXES is used.
- The ENABLE_QUERY_OPTIMIZER_HOTFIXES query hint is available starting in SQL Server 2016 SP1.
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.