{"id":802,"date":"2017-02-02T07:00:27","date_gmt":"2017-02-02T15:00:27","guid":{"rendered":"http:\/\/3.209.169.194\/blogs\/erin\/?p=802"},"modified":"2017-04-13T09:19:55","modified_gmt":"2017-04-13T16:19:55","slug":"forced-plans-and-compatibility-mode","status":"publish","type":"post","link":"https:\/\/www.sqlskills.com\/blogs\/erin\/forced-plans-and-compatibility-mode\/","title":{"rendered":"Forced Plans and Compatibility Mode"},"content":{"rendered":"<p>A question came up recently about plan guides and compatibility mode, and it got me thinking about forced plans in Query Store and compatibility mode.\u00a0 Imagine you upgraded to SQL Server 2016 and kept the compatibility mode for your database at 110 to use the legacy Cardinality Estimator.\u00a0 At some point, you have a plan that you force for a specific query, and that works great.\u00a0 As time goes on, you do testing with the new CE and eventually are ready to make the switch to compatibility mode 130.\u00a0 When you do that, does the forced plan continue to use compatibility mode 110?\u00a0 I had a guess at the answer but thought it was worth testing.<\/p>\n<p><strong>Setup<\/strong><\/p>\n<p>I restored a copy of WideWorldImporters to my SQL 2016 SP1 instance and set the compatibility mode to 110:<\/p>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">\r\nUSE &#x5B;master];\r\nGO\r\n\r\nRESTORE DATABASE &#x5B;WideWorldImporters]\r\nFROM\u00a0 DISK = N'C:\\Backups\\WideWorldImporters-Full.bak'\r\nWITH\u00a0 FILE = 1,\r\nMOVE N'WWI_Primary' TO N'C:\\Databases\\WideWorldImporters\\WideWorldImporters.mdf',\r\nMOVE N'WWI_UserData' TO N'C:\\Databases\\WideWorldImporters\\WideWorldImporters_UserData.ndf',\r\nMOVE N'WWI_Log' TO N'C:\\Databases\\WideWorldImporters\\WideWorldImporters.ldf',\r\nMOVE N'WWI_InMemory_Data_1' TO N'C:\\Databases\\WideWorldImporters\\WideWorldImporters_InMemory_Data_1',\r\nNOUNLOAD,\r\nREPLACE,\r\nSTATS = 5;\r\nGO\r\n\r\nALTER DATABASE &#x5B;WideWorldImporters] SET COMPATIBILITY_LEVEL = 110\r\nGO\r\n<\/pre>\n<p>Then I enabled Query Store and cleared out any old data that might exist (remember that WideWorldImporters is a sample database so who knows what might exist in the Query Store views):<\/p>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">\r\nUSE &#x5B;master];\r\nGO\r\n\r\nALTER DATABASE &#x5B;WideWorldImporters] SET QUERY_STORE = ON\r\nGO\r\n\r\nALTER DATABASE &#x5B;WideWorldImporters] SET QUERY_STORE (\r\nOPERATION_MODE = READ_WRITE,\r\nCLEANUP_POLICY = (STALE_QUERY_THRESHOLD_DAYS = 30),\r\nDATA_FLUSH_INTERVAL_SECONDS = 900,\r\nINTERVAL_LENGTH_MINUTES = 60,\r\nMAX_STORAGE_SIZE_MB = 512,\r\nQUERY_CAPTURE_MODE = ALL,\r\nSIZE_BASED_CLEANUP_MODE = AUTO,\r\nMAX_PLANS_PER_QUERY = 200);\r\nGO\r\n\r\nALTER DATABASE &#x5B;WideWorldImporters] SET QUERY_STORE CLEAR;\r\nGO\r\n<\/pre>\n<p>Next I\u2019ll create a stored procedure to use for testing, and then I\u2019ll run it twice with the RECOMPILE option, as this will generate two different plans.<\/p>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">\r\nUSE &#x5B;WideWorldImporters];\r\nGO\r\n\r\nDROP PROCEDURE IF EXISTS &#x5B;Sales].&#x5B;usp_GetFullProductInfo];\r\nGO\r\n\r\nCREATE PROCEDURE &#x5B;Sales].&#x5B;usp_GetFullProductInfo]\r\n@StockItemID INT\r\nAS\r\nSELECT\r\n&#x5B;o].&#x5B;CustomerID],\r\n&#x5B;o].&#x5B;OrderDate],\r\n&#x5B;ol].&#x5B;StockItemID],\r\n&#x5B;ol].&#x5B;Quantity],\r\n&#x5B;ol].&#x5B;UnitPrice]\r\nFROM &#x5B;Sales].&#x5B;Orders] &#x5B;o]\r\nJOIN &#x5B;Sales].&#x5B;OrderLines] &#x5B;ol] on &#x5B;o].&#x5B;OrderID] = &#x5B;ol].&#x5B;OrderID]\r\nWHERE &#x5B;StockItemID] = @StockItemID\r\nORDER BY &#x5B;o].&#x5B;OrderDate] DESC;\r\nGO\r\n\r\nEXEC &#x5B;Sales].&#x5B;usp_GetFullProductInfo] 220\u00a0 WITH RECOMPILE;\r\nGO\r\n\r\nEXEC &#x5B;Sales].&#x5B;usp_GetFullProductInfo] 105\u00a0 WITH RECOMPILE;\r\nGO\r\n<\/pre>\n<p><strong>Forcing a plan<\/strong><\/p>\n<p>We\u2019ll start by looking at the two different plans in Query Store.\u00a0 You can do this through the UI, or by using TSQL.\u00a0 I\u2019ll use both, just for fun, and we\u2019ll start with TSQL.<\/p>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">\r\nSELECT\r\n&#x5B;q].&#x5B;query_id],\r\n&#x5B;q].&#x5B;object_id],\r\n&#x5B;o].&#x5B;name],\r\n&#x5B;p].&#x5B;compatibility_level],\r\n&#x5B;qt].&#x5B;query_sql_text],\r\n&#x5B;p].&#x5B;plan_id],\r\nTRY_CONVERT(XML,&#x5B;p].&#x5B;query_plan]) AS &#x5B;QueryPlan]\r\nFROM &#x5B;sys].&#x5B;query_store_query] &#x5B;q]\r\nJOIN &#x5B;sys].&#x5B;query_store_query_text] &#x5B;qt]\r\nON &#x5B;q].&#x5B;query_text_id] = &#x5B;qt].&#x5B;query_text_id]\r\nJOIN &#x5B;sys].&#x5B;query_store_plan] &#x5B;p]\r\nON &#x5B;q].&#x5B;query_id] = &#x5B;p].&#x5B;query_id]\r\nJOIN &#x5B;sys].&#x5B;objects] &#x5B;o]\r\nON &#x5B;q].&#x5B;object_id] = &#x5B;o].&#x5B;object_id]\r\nWHERE &#x5B;q].&#x5B;object_id] = OBJECT_ID(N'Sales.usp_GetFullProductInfo');\r\nGO\r\n<\/pre>\n<p>&nbsp;<\/p>\n<figure id=\"attachment_803\" aria-describedby=\"caption-attachment-803\" style=\"width: 1327px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2017\/02\/query-store-output-two-different-plans.jpg\"><img fetchpriority=\"high\" decoding=\"async\" class=\"wp-image-803 size-full\" src=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2017\/02\/query-store-output-two-different-plans.jpg\" alt=\"Query Store output - two different plans\" width=\"1327\" height=\"106\" \/><\/a><figcaption id=\"caption-attachment-803\" class=\"wp-caption-text\">Query Store output &#8211; two different plans<\/figcaption><\/figure>\n<p>&nbsp;<\/p>\n<p>You can see in the output that there are two different plans (plan_id 3 and plan_id 4)for this stored procedure query.\u00a0 I can click on the XML link to see each plan, and then compare them, or I can do this from within Query Store.\u00a0 It\u2019s easier within Query Store, I just need to know the query_id (3).\u00a0 Within Management Studio, expand the WideWorldImporters database, expand Query Store, then double-click on Tracked Queries and enter the query_id in the Tracking Query box.<\/p>\n<p>&nbsp;<\/p>\n<figure id=\"attachment_804\" aria-describedby=\"caption-attachment-804\" style=\"width: 1024px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2017\/02\/two-different-plans-for-query_id-3.jpg\"><img decoding=\"async\" class=\"wp-image-804 size-large\" src=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2017\/02\/two-different-plans-for-query_id-3-1024x573.jpg\" alt=\"Two different plans for query_id 3\" width=\"1024\" height=\"573\" \/><\/a><figcaption id=\"caption-attachment-804\" class=\"wp-caption-text\">Two different plans for query_id 3<\/figcaption><\/figure>\n<p>&nbsp;<\/p>\n<p>You\u2019ll see that there are two plans, and to compare them you click on both plans in the plan id window (hold down the CTRL key to get them both) and then select Compare Plans.<\/p>\n<p>&nbsp;<\/p>\n<figure id=\"attachment_805\" aria-describedby=\"caption-attachment-805\" style=\"width: 1103px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2017\/02\/comparing-both-plans.jpg\"><img decoding=\"async\" class=\"size-full wp-image-805\" src=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2017\/02\/comparing-both-plans.jpg\" alt=\"Comparing both plans\" width=\"1103\" height=\"662\" \/><\/a><figcaption id=\"caption-attachment-805\" class=\"wp-caption-text\">Comparing both plans<\/figcaption><\/figure>\n<p>&nbsp;<\/p>\n<p>In looking at the plans, you see that the shapes are similar, but Plan 3 has a Nested Loop, while Plan 4 Merge Join that\u2019s fed by a Sort.\u00a0 For this example, we\u2019ll decide that the Nested Loop plan is \u201cbetter\u201d for this query, so that\u2019s the one we will force.<\/p>\n<p>However, before we make that change, let\u2019s see if we get a different plan with compatibility mode 130.<\/p>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">\r\nUSE &#x5B;master];\r\nGO\r\n\r\nALTER DATABASE &#x5B;WideWorldImporters] SET COMPATIBILITY_LEVEL = 130;\r\nGO\r\n\r\nUSE &#x5B;WideWorldImporters];\r\nGO\r\n\r\nEXEC &#x5B;Sales].&#x5B;usp_GetFullProductInfo] 105\u00a0 WITH RECOMPILE;\r\nGO\r\n<\/pre>\n<p>Check Query Store again\u2026<\/p>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">\r\nSELECT\r\n&#x5B;q].&#x5B;query_id],\r\n&#x5B;q].&#x5B;object_id],\r\n&#x5B;o].&#x5B;name],\r\n&#x5B;p].&#x5B;compatibility_level],\r\n&#x5B;qt].&#x5B;query_sql_text],\r\n&#x5B;p].&#x5B;plan_id],\r\nTRY_CONVERT(XML,&#x5B;p].&#x5B;query_plan]) AS &#x5B;QueryPlan]\r\nFROM &#x5B;sys].&#x5B;query_store_query] &#x5B;q]\r\nJOIN &#x5B;sys].&#x5B;query_store_query_text] &#x5B;qt]\r\nON &#x5B;q].&#x5B;query_text_id] = &#x5B;qt].&#x5B;query_text_id]\r\nJOIN &#x5B;sys].&#x5B;query_store_plan] &#x5B;p]\r\nON &#x5B;q].&#x5B;query_id] = &#x5B;p].&#x5B;query_id]\r\nJOIN &#x5B;sys].&#x5B;objects] &#x5B;o]\r\nON &#x5B;q].&#x5B;object_id] = &#x5B;o].&#x5B;object_id]\r\nWHERE &#x5B;q].&#x5B;object_id] = OBJECT_ID(N'Sales.usp_GetFullProductInfo');\r\nGO\r\n<\/pre>\n<figure id=\"attachment_806\" aria-describedby=\"caption-attachment-806\" style=\"width: 1340px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2017\/02\/query-store-output-now-three-different-plans.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-806\" src=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2017\/02\/query-store-output-now-three-different-plans.jpg\" alt=\"Query Store output - now three different plans\" width=\"1340\" height=\"136\" \/><\/a><figcaption id=\"caption-attachment-806\" class=\"wp-caption-text\">Query Store output &#8211; now three different plans<\/figcaption><\/figure>\n<p>We DO have a different plan!\u00a0 If we look at the plan, we see that the shape is still similar, but now we have a Hash Match with a Filter operator and a Clustered Index Scan.<\/p>\n<figure id=\"attachment_807\" aria-describedby=\"caption-attachment-807\" style=\"width: 840px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2017\/02\/plan-from-compatibility-mode-130.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-807\" src=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2017\/02\/plan-from-compatibility-mode-130.jpg\" alt=\"Plan from compatibility mode 130\" width=\"840\" height=\"212\" \/><\/a><figcaption id=\"caption-attachment-807\" class=\"wp-caption-text\">Plan from compatibility mode 130<\/figcaption><\/figure>\n<p>&nbsp;<\/p>\n<p>Now we want to force that Nested Loop plan.\u00a0 First, change the compatibility mode back to 110:<\/p>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">\r\nUSE &#x5B;master];\r\nGO\r\n\r\nALTER DATABASE &#x5B;WideWorldImporters] SET COMPATIBILITY_LEVEL = 110;\r\nGO\r\n<\/pre>\n<p>Next, force the plan that has the Nested Loop, and we can do this in the UI, or with TSQL.\u00a0 In the UI just go back to the Tracked Queries window, select the plan, and then Force Plan.\u00a0 To force the plan with TSQL, you need to know the query_id and plan_id:<\/p>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">\r\nUSE &#x5B;WideWorldImporters];\r\nGO\r\n\r\nEXEC sp_query_store_force_plan @query_id = 3, @plan_id = 3;\r\nGO\r\n<\/pre>\n<p>Now the plan is forced.\u00a0 If we enable the actual execution plan and re-run our stored procedure\u00a0<em>without the RECOMPILE on it<\/em> (because why would you use RECOMPILE on a query with a forced plan?) we see that the Nested Loop plan is used:<\/p>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">\r\nEXEC &#x5B;Sales].&#x5B;usp_GetFullProductInfo] 105;\r\nGO\r\n<\/pre>\n<figure id=\"attachment_808\" aria-describedby=\"caption-attachment-808\" style=\"width: 674px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2017\/02\/stored-procedures-execution-plan-after-being-forced.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-808\" src=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2017\/02\/stored-procedures-execution-plan-after-being-forced.jpg\" alt=\"Stored procedure's execution plan, after being forced\" width=\"674\" height=\"252\" \/><\/a><figcaption id=\"caption-attachment-808\" class=\"wp-caption-text\">Stored procedure&#8217;s execution plan, after being forced<\/figcaption><\/figure>\n<p>And here\u2019s the big test\u2026\u00a0 Change compatibility mode to 130 again, free procedure cache just for fun (this does not matter \u2013 when a plan is forced, it doesn\u2019t matter if the plan exists in cache or not), and then run the stored procedure and check the plan:<\/p>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">\r\nUSE &#x5B;master];\r\nGO\r\nALTER DATABASE &#x5B;WideWorldImporters] SET COMPATIBILITY_LEVEL = 130;\r\nGO\r\n\r\nUSE &#x5B;WideWorldImporters];\r\nGO\r\n\r\nEXEC &#x5B;Sales].&#x5B;usp_GetFullProductInfo] 105\u00a0 WITH RECOMPILE;\r\nGO\r\n<\/pre>\n<figure id=\"attachment_809\" aria-describedby=\"caption-attachment-809\" style=\"width: 747px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2017\/02\/stored-procedures-execution-plan-after-compatibility-mode-changed-to-130.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-809\" src=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2017\/02\/stored-procedures-execution-plan-after-compatibility-mode-changed-to-130.jpg\" alt=\"Stored procedure's execution plan, after compatibility mode changed to 130\" width=\"747\" height=\"279\" \/><\/a><figcaption id=\"caption-attachment-809\" class=\"wp-caption-text\">Stored procedure&#8217;s execution plan, after compatibility mode changed to 130<\/figcaption><\/figure>\n<p>Surprised? \u00a0The Nested Loop plan is still used.\u00a0 This is expected!\u00a0 It does not matter if the compatibility mode for the database is different than the compatibility mode for the plan.\u00a0 The forced plan is what\u2019s used.<\/p>\n<p><strong>Summary<\/strong><\/p>\n<p>In this example, even when the compatibility mode for the database changed, the forced plan was still used.\u00a0 Thus, forced plans are not tied to compatibility mode.\u00a0 This is a good thing.\u00a0 If you&#8217;ve upgraded to SQL Server 2016 and you are working to fix query performance issues related to the new cardinality estimator, forcing plans can be incredibly helpful in stabilizing performance without changing code to include trace flags or hints.\u00a0 However, do not assume that a forced plan will <em>always<\/em> be used.\u00a0 If you look at the <a href=\"https:\/\/docs.microsoft.com\/en-us\/sql\/relational-databases\/performance\/best-practice-with-the-query-store\">Best Practice with the Query Store<\/a> guidelines, there&#8217;s a section titled &#8220;Check the Status of Forced Plans Regularly.&#8221;\u00a0 Within that section is this note:<\/p>\n<p style=\"padding-left: 30px;\"><span style=\"color: #0000ff;\">However, as with plan hints and plan guides, forcing a plan is not a guarantee that it will be used in future executions.<\/span><\/p>\n<p>Therefore, while you force a plan because you want it to be used &#8211; to make query performance more stable &#8211; SQL Server does not guarantee it will <em>always<\/em> be used.\u00a0 There are cases when it cannot, and should not, be used, hence the recommendation to check the status of forced plans in sys.query_store_plan.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A question came up recently about plan guides and compatibility mode, and it got me thinking about forced plans in Query Store and compatibility mode.\u00a0 Imagine you upgraded to SQL Server 2016 and kept the compatibility mode for your database at 110 to use the legacy Cardinality Estimator.\u00a0 At some point, you have a plan [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[46],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.9.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Forced Plans and Compatibility Mode - Erin Stellato<\/title>\n<meta name=\"description\" content=\"Changing compatibility mode for a SQL Server database does not affect the use of a forced plan in Query Store.\" \/>\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\/forced-plans-and-compatibility-mode\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Forced Plans and Compatibility Mode - Erin Stellato\" \/>\n<meta property=\"og:description\" content=\"Changing compatibility mode for a SQL Server database does not affect the use of a forced plan in Query Store.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.sqlskills.com\/blogs\/erin\/forced-plans-and-compatibility-mode\/\" \/>\n<meta property=\"og:site_name\" content=\"Erin Stellato\" \/>\n<meta property=\"article:published_time\" content=\"2017-02-02T15:00:27+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-04-13T16:19:55+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2017\/02\/query-store-output-two-different-plans.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=\"7 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\/forced-plans-and-compatibility-mode\/\",\"url\":\"https:\/\/www.sqlskills.com\/blogs\/erin\/forced-plans-and-compatibility-mode\/\",\"name\":\"Forced Plans and Compatibility Mode - Erin Stellato\",\"isPartOf\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/erin\/#website\"},\"datePublished\":\"2017-02-02T15:00:27+00:00\",\"dateModified\":\"2017-04-13T16:19:55+00:00\",\"author\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/erin\/#\/schema\/person\/76170223ffffa1df03fd9be5b66cb158\"},\"description\":\"Changing compatibility mode for a SQL Server database does not affect the use of a forced plan in Query Store.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/erin\/forced-plans-and-compatibility-mode\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.sqlskills.com\/blogs\/erin\/forced-plans-and-compatibility-mode\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/erin\/forced-plans-and-compatibility-mode\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.sqlskills.com\/blogs\/erin\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Forced Plans and Compatibility Mode\"}]},{\"@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":"Forced Plans and Compatibility Mode - Erin Stellato","description":"Changing compatibility mode for a SQL Server database does not affect the use of a forced plan in Query Store.","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\/forced-plans-and-compatibility-mode\/","og_locale":"en_US","og_type":"article","og_title":"Forced Plans and Compatibility Mode - Erin Stellato","og_description":"Changing compatibility mode for a SQL Server database does not affect the use of a forced plan in Query Store.","og_url":"https:\/\/www.sqlskills.com\/blogs\/erin\/forced-plans-and-compatibility-mode\/","og_site_name":"Erin Stellato","article_published_time":"2017-02-02T15:00:27+00:00","article_modified_time":"2017-04-13T16:19:55+00:00","og_image":[{"url":"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2017\/02\/query-store-output-two-different-plans.jpg"}],"author":"Erin Stellato","twitter_misc":{"Written by":"Erin Stellato","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.sqlskills.com\/blogs\/erin\/forced-plans-and-compatibility-mode\/","url":"https:\/\/www.sqlskills.com\/blogs\/erin\/forced-plans-and-compatibility-mode\/","name":"Forced Plans and Compatibility Mode - Erin Stellato","isPartOf":{"@id":"https:\/\/www.sqlskills.com\/blogs\/erin\/#website"},"datePublished":"2017-02-02T15:00:27+00:00","dateModified":"2017-04-13T16:19:55+00:00","author":{"@id":"https:\/\/www.sqlskills.com\/blogs\/erin\/#\/schema\/person\/76170223ffffa1df03fd9be5b66cb158"},"description":"Changing compatibility mode for a SQL Server database does not affect the use of a forced plan in Query Store.","breadcrumb":{"@id":"https:\/\/www.sqlskills.com\/blogs\/erin\/forced-plans-and-compatibility-mode\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.sqlskills.com\/blogs\/erin\/forced-plans-and-compatibility-mode\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.sqlskills.com\/blogs\/erin\/forced-plans-and-compatibility-mode\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.sqlskills.com\/blogs\/erin\/"},{"@type":"ListItem","position":2,"name":"Forced Plans and Compatibility Mode"}]},{"@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\/802"}],"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=802"}],"version-history":[{"count":0,"href":"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-json\/wp\/v2\/posts\/802\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-json\/wp\/v2\/media?parent=802"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-json\/wp\/v2\/categories?post=802"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-json\/wp\/v2\/tags?post=802"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}