{"id":781,"date":"2016-11-09T06:00:04","date_gmt":"2016-11-09T14:00:04","guid":{"rendered":"http:\/\/3.209.169.194\/blogs\/erin\/?p=781"},"modified":"2017-04-13T09:19:33","modified_gmt":"2017-04-13T16:19:33","slug":"trace-flag-information-in-query-plans","status":"publish","type":"post","link":"https:\/\/www.sqlskills.com\/blogs\/erin\/trace-flag-information-in-query-plans\/","title":{"rendered":"Trace Flag Information in Query Plans"},"content":{"rendered":"<p>I was perusing the <a href=\"https:\/\/support.microsoft.com\/en-us\/help\/3171021\/sql-server-2014-service-pack-2-release-information\">release notes for SQL Server 2014 SP2<\/a> and found this gem:<\/p>\n<p style=\"padding-left: 30px;\"><a href=\"https:\/\/support.microsoft.com\/en-us\/help\/3170115\/information-about-enabled-trace-flags-is-added-to-the-showplan-xml-in-sql-server-2014-sp2-or-2016\">Information about enabled trace flags is added to the showplan XML in SQL Server 2014 SP2<\/a><\/p>\n<p>Ohhhhhh, very cool.\u00a0 This is great information for troubleshooting!<\/p>\n<p>I fired up my 2014 VM and applied SP2, then verified the trace flags I had enabled for the instance:<\/p>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">\r\nDBCC TRACESTATUS;\r\nGO\r\n<\/pre>\n<figure id=\"attachment_782\" aria-describedby=\"caption-attachment-782\" style=\"width: 434px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2016\/11\/trace-flags-enabled.jpg\"><img fetchpriority=\"high\" decoding=\"async\" class=\"size-full wp-image-782\" src=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2016\/11\/trace-flags-enabled.jpg\" alt=\"Trace flags enabled\" width=\"434\" height=\"125\" \/><\/a><figcaption id=\"caption-attachment-782\" class=\"wp-caption-text\">Trace flags enabled<\/figcaption><\/figure>\n<p>I have three trace flags enabled, which we typically recommend for all installations*.<\/p>\n<p>So let\u2019s run a few queries and then check the plan.\u00a0 For the first query I\u2019m not adding any other trace flags:<\/p>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">\r\nSELECT &#x5B;p].&#x5B;ProductID],&#x5B;p].&#x5B;StandardCost], &#x5B;p].&#x5B;ListPrice], &#x5B;pi].&#x5B;Quantity], &#x5B;p].&#x5B;Name]\r\nFROM &#x5B;Production].&#x5B;Product] &#x5B;p]\r\nJOIN &#x5B;Production].&#x5B;ProductInventory] &#x5B;pi] ON &#x5B;p].&#x5B;ProductID] = &#x5B;pi].&#x5B;ProductID]\r\nWHERE &#x5B;p].&#x5B;SellEndDate] IS NOT NULL\r\nAND &#x5B;pi].&#x5B;Quantity]\u00a0 &lt; 1000;\r\nGO\r\n<\/pre>\n<figure id=\"attachment_784\" aria-describedby=\"caption-attachment-784\" style=\"width: 580px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2016\/11\/plan11.jpg\"><img decoding=\"async\" class=\"size-full wp-image-784\" src=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2016\/11\/plan11.jpg\" alt=\"Query Plan\" width=\"580\" height=\"272\" srcset=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2016\/11\/plan11.jpg 580w, https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2016\/11\/plan11-300x141.jpg 300w\" sizes=\"(max-width: 580px) 100vw, 580px\" \/><\/a><figcaption id=\"caption-attachment-784\" class=\"wp-caption-text\">Query Plan<\/figcaption><\/figure>\n<p>The plan is nothing too crazy \u2013 it\u2019s not great because it\u2019s scanning the clustered indexes, but I\u2019m not tuning here so we\u2019ll ignore that for now.\u00a0 But notice that when I click on the SELECT operator with the Properties window open, you\u2019ll see an entry for TraceFlags at the bottom:<\/p>\n<figure id=\"attachment_785\" aria-describedby=\"caption-attachment-785\" style=\"width: 958px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2016\/11\/properies.jpg\"><img decoding=\"async\" class=\"size-full wp-image-785\" src=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2016\/11\/properies.jpg\" alt=\"Properties for the SELECT operator\" width=\"958\" height=\"493\" srcset=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2016\/11\/properies.jpg 958w, https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2016\/11\/properies-300x154.jpg 300w, https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2016\/11\/properies-900x463.jpg 900w\" sizes=\"(max-width: 958px) 100vw, 958px\" \/><\/a><figcaption id=\"caption-attachment-785\" class=\"wp-caption-text\">Properties for the SELECT operator<\/figcaption><\/figure>\n<p>If we expand that, we can see the three trace flags that I have enabled, and it\u2019s noted whether they are enabled globally or locally, and at compile time (IsCompileTime True) and run time (IsCompileTime False):<\/p>\n<figure id=\"attachment_786\" aria-describedby=\"caption-attachment-786\" style=\"width: 365px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2016\/11\/flags-from-properties.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-786\" src=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2016\/11\/flags-from-properties.jpg\" alt=\"Trace flag information from the properties window\" width=\"365\" height=\"479\" srcset=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2016\/11\/flags-from-properties.jpg 365w, https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2016\/11\/flags-from-properties-229x300.jpg 229w\" sizes=\"(max-width: 365px) 100vw, 365px\" \/><\/a><figcaption id=\"caption-attachment-786\" class=\"wp-caption-text\">Trace flag information from the properties window<\/figcaption><\/figure>\n<p>And I can also go directly to the XML to find the information:<\/p>\n<figure id=\"attachment_787\" aria-describedby=\"caption-attachment-787\" style=\"width: 527px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2016\/11\/tfs.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-787\" src=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2016\/11\/tfs.jpg\" alt=\"Trace flag information from the plan XML\" width=\"527\" height=\"250\" \/><\/a><figcaption id=\"caption-attachment-787\" class=\"wp-caption-text\">Trace flag information from the plan XML<\/figcaption><\/figure>\n<p>Cool.\u00a0 What happens if I use a trace flag, like 9130 to push out residual predicates into a FILTER operator, in a query hint?<\/p>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">\r\nSELECT &#x5B;p].&#x5B;ProductID],&#x5B;p].&#x5B;StandardCost], &#x5B;p].&#x5B;ListPrice], &#x5B;pi].&#x5B;Quantity], &#x5B;p].&#x5B;Name]\r\nFROM &#x5B;Production].&#x5B;Product] &#x5B;p]\r\nJOIN &#x5B;Production].&#x5B;ProductInventory] &#x5B;pi] ON &#x5B;p].&#x5B;ProductID] = &#x5B;pi].&#x5B;ProductID]\r\nWHERE &#x5B;p].&#x5B;SellEndDate] IS NOT NULL\r\nAND &#x5B;pi].&#x5B;Quantity]\u00a0 &lt; 1000\r\nOPTION (QUERYTRACEON 9130);\r\nGO\r\n<\/pre>\n<p>We see the FILTER operators in the plan:<\/p>\n<figure id=\"attachment_788\" aria-describedby=\"caption-attachment-788\" style=\"width: 696px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2016\/11\/plan-with-hint.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-788\" src=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2016\/11\/plan-with-hint.jpg\" alt=\"Query plan with FILTER operator\" width=\"696\" height=\"269\" srcset=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2016\/11\/plan-with-hint.jpg 696w, https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2016\/11\/plan-with-hint-300x116.jpg 300w\" sizes=\"(max-width: 696px) 100vw, 696px\" \/><\/a><figcaption id=\"caption-attachment-788\" class=\"wp-caption-text\">Query plan with FILTER operator<\/figcaption><\/figure>\n<p>And in the XML we see 9130 for the compilation as a session trace flag, but it doesn&#8217;t show up in the execution flags:<\/p>\n<figure id=\"attachment_789\" aria-describedby=\"caption-attachment-789\" style=\"width: 537px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2016\/11\/tfs-with-hint.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-789\" src=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2016\/11\/tfs-with-hint.jpg\" alt=\"Trace flags (with hint) from qeury plan XML\" width=\"537\" height=\"276\" \/><\/a><figcaption id=\"caption-attachment-789\" class=\"wp-caption-text\">Trace flags (with hint) from qeury plan XML<\/figcaption><\/figure>\n<p>Now, in the aforementioned examples, I\u2019ve run the query in Management Studio and captured the actual plan.\u00a0 Do I get all the same information from the plan cache?\u00a0 To check, I\u2019ll clear the plan cache, re-run the most query, and then interrogate the plan cache to see what I get:<\/p>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">\r\nDBCC FREEPROCCACHE; \/* not for production use! *\/\r\nGO\r\n\r\nSELECT &#x5B;p].&#x5B;ProductID],&#x5B;p].&#x5B;StandardCost], &#x5B;p].&#x5B;ListPrice], &#x5B;pi].&#x5B;Quantity], &#x5B;p].&#x5B;Name]\r\nFROM &#x5B;Production].&#x5B;Product] &#x5B;p]\r\nJOIN &#x5B;Production].&#x5B;ProductInventory] &#x5B;pi] ON &#x5B;p].&#x5B;ProductID] = &#x5B;pi].&#x5B;ProductID]\r\nWHERE &#x5B;p].&#x5B;SellEndDate] IS NOT NULL\r\nAND &#x5B;pi].&#x5B;Quantity]\u00a0 &lt; 1000\r\nOPTION (QUERYTRACEON 9130);\r\nGO\r\n\r\nSET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;\r\nGO\r\n\r\nSELECT &#x5B;s].&#x5B;text], &#x5B;qs].&#x5B;last_execution_time], &#x5B;qp].&#x5B;query_plan]\r\nFROM &#x5B;sys].&#x5B;dm_exec_query_stats] &#x5B;qs]\r\nCROSS APPLY &#x5B;sys].&#x5B;dm_exec_query_plan] (&#x5B;qs].&#x5B;plan_handle]) qp\r\nCROSS APPLY &#x5B;sys].&#x5B;dm_exec_sql_text](&#x5B;qs].&#x5B;plan_handle]) &#x5B;s]\r\nWHERE &#x5B;s].&#x5B;text]\r\nLIKE '%SellEndDate%';\r\nGO\r\n\r\nSET TRANSACTION ISOLATION LEVEL READ COMMITTED;\r\nGO\r\n<\/pre>\n<p>When I open the query plan from the output and look at the XML, I see compilation information, but no runtime info:<\/p>\n<figure id=\"attachment_790\" aria-describedby=\"caption-attachment-790\" style=\"width: 541px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2016\/11\/tfs-from-plan.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-790\" src=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2016\/11\/tfs-from-plan.jpg\" alt=\"Trace flag information from query plan XML retrieved from cache\" width=\"541\" height=\"150\" srcset=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2016\/11\/tfs-from-plan.jpg 541w, https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2016\/11\/tfs-from-plan-300x83.jpg 300w\" sizes=\"(max-width: 541px) 100vw, 541px\" \/><\/a><figcaption id=\"caption-attachment-790\" class=\"wp-caption-text\">Trace flag information from query plan XML retrieved from cache<\/figcaption><\/figure>\n<p>Presumably, if I run the query again, without clearing the plan cache, and taking off the 9130 trace flag, I would get a new entry:<\/p>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">\r\nSELECT &#x5B;p].&#x5B;ProductID],&#x5B;p].&#x5B;StandardCost], &#x5B;p].&#x5B;ListPrice], &#x5B;pi].&#x5B;Quantity], &#x5B;p].&#x5B;Name]\r\nFROM &#x5B;Production].&#x5B;Product] &#x5B;p]\r\nJOIN &#x5B;Production].&#x5B;ProductInventory] &#x5B;pi] ON &#x5B;p].&#x5B;ProductID] = &#x5B;pi].&#x5B;ProductID]\r\nWHERE &#x5B;p].&#x5B;SellEndDate] IS NOT NULL\r\nAND &#x5B;pi].&#x5B;Quantity]\u00a0 &lt; 1000;\r\nGO\r\n\r\nSET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;\r\nGO\r\n\r\nSELECT &#x5B;s].&#x5B;text], &#x5B;qs].&#x5B;last_execution_time], &#x5B;qp].&#x5B;query_plan]\r\nFROM &#x5B;sys].&#x5B;dm_exec_query_stats] &#x5B;qs]\r\nCROSS APPLY &#x5B;sys].&#x5B;dm_exec_query_plan] (&#x5B;qs].&#x5B;plan_handle]) qp\r\nCROSS APPLY &#x5B;sys].&#x5B;dm_exec_sql_text](&#x5B;qs].&#x5B;plan_handle]) &#x5B;s]\r\nWHERE &#x5B;s].&#x5B;text]\r\nLIKE '%SellEndDate%';\r\nGO\r\n\r\nSET TRANSACTION ISOLATION LEVEL READ COMMITTED;\r\nGO\r\n<\/pre>\n<figure id=\"attachment_791\" aria-describedby=\"caption-attachment-791\" style=\"width: 1391px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2016\/11\/cache-output.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-791\" src=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2016\/11\/cache-output.jpg\" alt=\"Query information in the plan cache\" width=\"1391\" height=\"113\" srcset=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2016\/11\/cache-output.jpg 1391w, https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2016\/11\/cache-output-300x24.jpg 300w, https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2016\/11\/cache-output-1024x83.jpg 1024w, https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2016\/11\/cache-output-900x73.jpg 900w\" sizes=\"(max-width: 1391px) 100vw, 1391px\" \/><\/a><figcaption id=\"caption-attachment-791\" class=\"wp-caption-text\">Query information in the plan cache<\/figcaption><\/figure>\n<p>True.\u00a0 When I check the plan for the second entry, with the later execution time, in the XML I find:<\/p>\n<figure id=\"attachment_792\" aria-describedby=\"caption-attachment-792\" style=\"width: 528px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2016\/11\/tfs-again.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-792\" src=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2016\/11\/tfs-again.jpg\" alt=\"Trace flags from query plan XML (no hint)\" width=\"528\" height=\"123\" srcset=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2016\/11\/tfs-again.jpg 528w, https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2016\/11\/tfs-again-300x70.jpg 300w\" sizes=\"(max-width: 528px) 100vw, 528px\" \/><\/a><figcaption id=\"caption-attachment-792\" class=\"wp-caption-text\">Trace flags from query plan XML (no hint)<\/figcaption><\/figure>\n<p>Ok, so I can find what trace flags are enabled when a query is compiled, and if anyone is using QUERYTRACEON to enable trace flags, I can see that here as well.\u00a0 (If you\u2019re wondering, yes, I could see also see that from querying the plan cache because it\u2019s in the text of the query.)\u00a0 On a bigger scale, I can mine the plan cache for this information.\u00a0 HUGE thanks to Jonathan for saving me from a losing battle with XQuery:<\/p>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">\r\nSET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;\r\nGO\r\n\r\nWITH XMLNAMESPACES\r\n(DEFAULT 'http:\/\/schemas.microsoft.com\/sqlserver\/2004\/07\/showplan')\r\nSELECT\r\nSTUFF((SELECT ', ' +\u00a0 tf.value('(.\/@Value)&#x5B;1]', 'varchar(10)')\r\nFROM stmt.nodes('.\/QueryPlan\/TraceFlags&#x5B;@IsCompileTime=&quot;1&quot;]\/TraceFlag&#x5B;@Scope=&quot;Global&quot;]') AS t(tf)\r\nFOR XML PATH('')\r\n), 1, 2, '') AS GlobalTraceFlags,\r\nSTUFF((SELECT ', ' +\u00a0 tf.value('(.\/@Value)&#x5B;1]', 'varchar(10)')\r\nFROM stmt.nodes('.\/QueryPlan\/TraceFlags&#x5B;@IsCompileTime=&quot;1&quot;]\/TraceFlag&#x5B;@Scope=&quot;Session&quot;]') AS t(tf)\r\nFOR XML PATH('')\r\n), 1, 2, '') AS SessionTraceFlags,\r\nstmt.query('.') as stmt_node,\r\ncp.usecounts,\r\nqp.query_plan,\r\ncp.plan_handle,\r\nqp.objectid,\r\ncp.objtype,\r\ncp.cacheobjtype,\r\ncp.size_in_bytes\r\nFROM sys.dm_exec_cached_plans AS cp\r\nCROSS APPLY sys.dm_exec_query_plan(plan_handle) AS qp\r\nCROSS APPLY query_plan.nodes('\/ShowPlanXML\/BatchSequence\/Batch\/Statements\/StmtSimple') AS batch(stmt)\r\nWHERE stmt.exist('.\/QueryPlan\/TraceFlags&#x5B;@IsCompileTime=&quot;1&quot;]') = 1\r\nOPTION(RECOMPILE, MAXDOP 1);\r\n<\/pre>\n<figure id=\"attachment_793\" aria-describedby=\"caption-attachment-793\" style=\"width: 1179px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2016\/11\/xqueryoutput.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-793\" src=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2016\/11\/xqueryoutput.jpg\" alt=\"Output from query that checks the plan cache\" width=\"1179\" height=\"362\" srcset=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2016\/11\/xqueryoutput.jpg 1179w, https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2016\/11\/xqueryoutput-300x92.jpg 300w, https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2016\/11\/xqueryoutput-1024x314.jpg 1024w, https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2016\/11\/xqueryoutput-900x276.jpg 900w\" sizes=\"(max-width: 1179px) 100vw, 1179px\" \/><\/a><figcaption id=\"caption-attachment-793\" class=\"wp-caption-text\">Output from query that checks the plan cache<\/figcaption><\/figure>\n<p>Awesome&#8230;Jon&#8217;s code breaks out global and session trace flags from the query plan, which makes it easy to find any session level flags in use.\u00a0 Note that this query will return the entire plan cache, so I recommend including additional predicates in the WHERE clause (e.g. where the session flag is NOT NULL).<\/p>\n<p>*Why we recommend 3226 and 1118:<\/p>\n<p><a href=\"https:\/\/www.sqlskills.com\/blogs\/paul\/fed-up-with-backup-success-messages-bloating-your-error-logs\/\">Fed up with BACKUP success messages bloating your error logs?<\/a><\/p>\n<p><a href=\"https:\/\/www.sqlskills.com\/blogs\/paul\/misconceptions-around-tf-1118\/\">Misconceptions around TF 1118<\/a><\/p>\n<p>*Note that 4199 is no longer needed in SQL Server 2016 if you\u2019re using database compatibility mode 130, see <a href=\"https:\/\/support.microsoft.com\/en-us\/help\/974006\/sql-server-query-optimizer-hotfix-trace-flag-4199-servicing-model\">SQL Server query optimizer hotfix trace flag 4199 servicing model.<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I was perusing the release notes for SQL Server 2014 SP2 and found this gem: Information about enabled trace flags is added to the showplan XML in SQL Server 2014 SP2 Ohhhhhh, very cool.\u00a0 This is great information for troubleshooting! I fired up my 2014 VM and applied SP2, then verified the trace flags I [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.9.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Trace Flag Information in Query Plans - Erin Stellato<\/title>\n<meta name=\"description\" content=\"Query plans in SQL Server 2014 SP2 include a new attribute, TraceFlags, which lists trace flags enabled when a query is compiled and executed.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.sqlskills.com\/blogs\/erin\/trace-flag-information-in-query-plans\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Trace Flag Information in Query Plans - Erin Stellato\" \/>\n<meta property=\"og:description\" content=\"Query plans in SQL Server 2014 SP2 include a new attribute, TraceFlags, which lists trace flags enabled when a query is compiled and executed.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.sqlskills.com\/blogs\/erin\/trace-flag-information-in-query-plans\/\" \/>\n<meta property=\"og:site_name\" content=\"Erin Stellato\" \/>\n<meta property=\"article:published_time\" content=\"2016-11-09T14:00:04+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-04-13T16:19:33+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2016\/11\/trace-flags-enabled.jpg\" \/>\n<meta name=\"author\" content=\"Erin Stellato\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Erin Stellato\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/erin\/trace-flag-information-in-query-plans\/\",\"url\":\"https:\/\/www.sqlskills.com\/blogs\/erin\/trace-flag-information-in-query-plans\/\",\"name\":\"Trace Flag Information in Query Plans - Erin Stellato\",\"isPartOf\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/erin\/#website\"},\"datePublished\":\"2016-11-09T14:00:04+00:00\",\"dateModified\":\"2017-04-13T16:19:33+00:00\",\"author\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/erin\/#\/schema\/person\/76170223ffffa1df03fd9be5b66cb158\"},\"description\":\"Query plans in SQL Server 2014 SP2 include a new attribute, TraceFlags, which lists trace flags enabled when a query is compiled and executed.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/erin\/trace-flag-information-in-query-plans\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.sqlskills.com\/blogs\/erin\/trace-flag-information-in-query-plans\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/erin\/trace-flag-information-in-query-plans\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.sqlskills.com\/blogs\/erin\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Trace Flag Information in Query Plans\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/erin\/#website\",\"url\":\"https:\/\/www.sqlskills.com\/blogs\/erin\/\",\"name\":\"Erin Stellato\",\"description\":\"The SQL Sequel\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.sqlskills.com\/blogs\/erin\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/erin\/#\/schema\/person\/76170223ffffa1df03fd9be5b66cb158\",\"name\":\"Erin Stellato\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/erin\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/0c8b485bd54ea26b57e99f79b525f409?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/0c8b485bd54ea26b57e99f79b525f409?s=96&d=mm&r=g\",\"caption\":\"Erin Stellato\"},\"sameAs\":[\"http:\/\/3.209.169.194\/blogs\/erin\"],\"url\":\"https:\/\/www.sqlskills.com\/blogs\/erin\/author\/erin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Trace Flag Information in Query Plans - Erin Stellato","description":"Query plans in SQL Server 2014 SP2 include a new attribute, TraceFlags, which lists trace flags enabled when a query is compiled and executed.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.sqlskills.com\/blogs\/erin\/trace-flag-information-in-query-plans\/","og_locale":"en_US","og_type":"article","og_title":"Trace Flag Information in Query Plans - Erin Stellato","og_description":"Query plans in SQL Server 2014 SP2 include a new attribute, TraceFlags, which lists trace flags enabled when a query is compiled and executed.","og_url":"https:\/\/www.sqlskills.com\/blogs\/erin\/trace-flag-information-in-query-plans\/","og_site_name":"Erin Stellato","article_published_time":"2016-11-09T14:00:04+00:00","article_modified_time":"2017-04-13T16:19:33+00:00","og_image":[{"url":"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2016\/11\/trace-flags-enabled.jpg"}],"author":"Erin Stellato","twitter_misc":{"Written by":"Erin Stellato","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.sqlskills.com\/blogs\/erin\/trace-flag-information-in-query-plans\/","url":"https:\/\/www.sqlskills.com\/blogs\/erin\/trace-flag-information-in-query-plans\/","name":"Trace Flag Information in Query Plans - Erin Stellato","isPartOf":{"@id":"https:\/\/www.sqlskills.com\/blogs\/erin\/#website"},"datePublished":"2016-11-09T14:00:04+00:00","dateModified":"2017-04-13T16:19:33+00:00","author":{"@id":"https:\/\/www.sqlskills.com\/blogs\/erin\/#\/schema\/person\/76170223ffffa1df03fd9be5b66cb158"},"description":"Query plans in SQL Server 2014 SP2 include a new attribute, TraceFlags, which lists trace flags enabled when a query is compiled and executed.","breadcrumb":{"@id":"https:\/\/www.sqlskills.com\/blogs\/erin\/trace-flag-information-in-query-plans\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.sqlskills.com\/blogs\/erin\/trace-flag-information-in-query-plans\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.sqlskills.com\/blogs\/erin\/trace-flag-information-in-query-plans\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.sqlskills.com\/blogs\/erin\/"},{"@type":"ListItem","position":2,"name":"Trace Flag Information in Query Plans"}]},{"@type":"WebSite","@id":"https:\/\/www.sqlskills.com\/blogs\/erin\/#website","url":"https:\/\/www.sqlskills.com\/blogs\/erin\/","name":"Erin Stellato","description":"The SQL Sequel","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.sqlskills.com\/blogs\/erin\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.sqlskills.com\/blogs\/erin\/#\/schema\/person\/76170223ffffa1df03fd9be5b66cb158","name":"Erin Stellato","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.sqlskills.com\/blogs\/erin\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/0c8b485bd54ea26b57e99f79b525f409?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/0c8b485bd54ea26b57e99f79b525f409?s=96&d=mm&r=g","caption":"Erin Stellato"},"sameAs":["http:\/\/3.209.169.194\/blogs\/erin"],"url":"https:\/\/www.sqlskills.com\/blogs\/erin\/author\/erin\/"}]}},"_links":{"self":[{"href":"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-json\/wp\/v2\/posts\/781"}],"collection":[{"href":"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-json\/wp\/v2\/comments?post=781"}],"version-history":[{"count":0,"href":"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-json\/wp\/v2\/posts\/781\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-json\/wp\/v2\/media?parent=781"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-json\/wp\/v2\/categories?post=781"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-json\/wp\/v2\/tags?post=781"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}