There is a new Cardinality Estimator in SQL 2014.  I wanted to drop a quick post to cover a few key points;

All of this can be found in Optimizing Your Query Plans with the SQL Server 2014 Cardinality Estimator

A re-designed cardinality estimator in SQL 2014 has been implemented to improve the quality, performance, and predictability of query plans.  The goal was for the QO to behave better!  In lab testing though there are a couple things I want to point out; If you have over engineered your queries e.g.  you exploit known goofy behavior or you are a frequent user of QURETRACEON to change the behavior QO for a specific query, you need to retest everything, I cannot stress that enough. 

If you upgrade and find this out after the fact, all you have to do to end your temporary nightmare is change the database compatibility level back 110, this will invoke the “70” Cardinality estimator.  This is good to know if you need to implement the old behavior in a hurry, like on Monday morning when your users come in and start hammering your brand new SQL 2014 upgraded instance.  Having the database in compatibility 120 will invoke the shiny new estimator in 2014.  

If for some crazy reason you end up with only the execution plan from a query as part of a later investigation, you can verify the estimator that was used by checking the execution plan XML and searching for “CardinalityEstimationModelVersion=” your choices are ‘70’ and ‘120’. 

You can also use Trace Flag 2312 to implement the new behavior on a single query under the old cardinality estimator (70) using the QUERYTRACEON or use Trace Flag 9481 under the new cardinality estimator (120) to force the old behavior for a single query.  Not confusing at all, right? 

Additionally, improvements have been made to the ascending key issue that was addressed by trace flags 2389 and 2390, if you have been using them be sure to test your workload with the new CE.  

We have just released a new paper authored by Joe Sack on all of the ins and outs of the new CE, happy reading!   

Optimizing Your Query Plans with the SQL Server 2014 Cardinality Estimator