<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Query Processor | Tag Archives: TF 2312</title>
	<atom:link href="/tag/tf-2312/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.queryprocessor.com</link>
	<description>Dmitry Pilugin&#039;s Notes</description>
	<lastBuildDate>Fri, 22 Jul 2016 20:53:05 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>Cardinality Estimation Framework Version Control</title>
		<link>http://www.queryprocessor.com/ce-version/</link>
		<comments>http://www.queryprocessor.com/ce-version/#comments</comments>
		<pubDate>Thu, 01 May 2014 14:54:47 +0000</pubDate>
		<dc:creator><![CDATA[SomewhereSomehow]]></dc:creator>
				<category><![CDATA[cardinality estimation]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[cardinality]]></category>
		<category><![CDATA[TF 2312]]></category>
		<category><![CDATA[TF 9481]]></category>
		<category><![CDATA[version]]></category>

		<guid isPermaLink="false">http://www.queryprocessor.com/?p=214</guid>
		<description><![CDATA[This is a small post about how you may control the cardinality estimator version and determine which version was used to build a plan. I don&#8217;t like re-writes, and this post is a complete re-write of the documentation. However, I decided to write it for the complete picture in my cardinality estimation series. Feel free [...]]]></description>
				<content:encoded><![CDATA[<p>This is a small post about how you may control the cardinality estimator version and determine which version was used to build a plan.</p>
<p>I don&#8217;t like re-writes, and this post is a complete re-write of the documentation. However, I decided to write it for the complete picture in my cardinality estimation series. Feel free to skip it, nothing really new here, if you are familiar with the theme from the other sources.</p>
<p><span id="more-214"></span></p>
<p>The version of the cardinality framework is determined by the query database context, where the database has a specific compatibility level.</p>
<p>When you create a database in SQL Server 2014 it has the latest compatibility level equals 120 by default. If you issue a query in that database context, the new cardinality version will be used. You may verify this by inspecting the plan property &#8220;<strong>CardinalityEstimationModelVersion</strong>&#8221; of the root language element (the one with the green icon), SELECT, for example.</p>
<p>If you issue a query in a database context that is less than 120 level compatibility, the old version of the cardinality estimation framework will be used.</p>
<p>If the new cardinality estimation version was used you&#8217;ll see the value <strong>120</strong> (you may remember it as 12.0 &#8211; the SQL Server 2014 version number) or <strong>70</strong> (also the server version number 7.0, because the old one was first introduced in the early 1998 for the SQL Server 7.0 and then was evolved without major concept changes).</p>
<p>Here is how it looks like:<br />
<img src="/wp-content/uploads/2014/05/31.png" alt="Cardinality Framework Version" /></p>
<div class="note">Please, make sure, when searching the CardinalityEstimationModeVersion property, that you are using the SQL Server Management Studio 2014. If you use SSMS 2012, for example, it will silently throw it out, even without telling you, and you won&#8217;t see it!</div>
<p>When Microsoft developed the new cardinality estimation framework, there was a goal to improve the quality of plans, however, there wasn&#8217;t a goal to avoid any regressions. That means that you should be prepared to regressions and know how to make an easy fix. Also, you should test your workload before moving on to the new cardinality mechanism.</p>
<p>Exactly for that purpose Microsoft issued two new trace flags, that are officially documented. TF 2312 to force the new cardinality estimation behavior, regardless of the database compatibility level, and TF 9481 to force the old one, also regardless of the compatibility level. You may use these flags on various levels, globally, session or query.</p>
<p>That opens a lot of possible scenarios, i&#8217;ll enlist some of them:</p>
<ul>
<li>You want to use the new features, like parallel SELECT INTO, but don&#8217;t want to enable the new CE &#8211; enable TF 9481 globally.</li>
<li>You want to try the new CE, but you are afraid of regressions &#8211; leave the compatibility level lower than 120 and enable the new CE in a particular query with the TF 2312, using QUERYTRACEON option, to test it.</li>
<li>You enabled the new CE and everything is fine, except a few queries that had a better plan with the old CE- use TF 9481 and the option QUERYTRACEON to leverage these particular queries.</li>
</ul>
<p>You may imagine the scenario you want, what is needed to remember, that you have a full control over what&#8217;s happening &#8211; if you don&#8217;t like it &#8211; simply turn it off.</p>
<p>The next question naturally is, what if both TFs are enabled. In this case they neutralize each other and the behavior is if no TF were enabled.</p>
<p>Now we are ready to move on to the changes of the new cardinality estimation framework!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.queryprocessor.com/ce-version/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

 Served from: www.queryprocessor.com @ 2016-08-02 16:31:01 by W3 Total Cache -->