{"id":857,"date":"2017-09-25T12:28:04","date_gmt":"2017-09-25T19:28:04","guid":{"rendered":"http:\/\/3.209.169.194\/blogs\/erin\/?p=857"},"modified":"2017-09-26T08:42:57","modified_gmt":"2017-09-26T15:42:57","slug":"changes-to-query-text-and-the-effects-in-query-store","status":"publish","type":"post","link":"https:\/\/www.sqlskills.com\/blogs\/erin\/changes-to-query-text-and-the-effects-in-query-store\/","title":{"rendered":"Changes to query text and the effects in Query Store"},"content":{"rendered":"<p>In this week&#8217;s <a href=\"https:\/\/www.sqlskills.com\/join-the-sqlskills-insider-community\/\">Insider newsletter<\/a>, Paul talked about an interesting customer issue I ran into last week related to Query Store, and an inadvertent change to a query&#8217;s text.\u00a0 I thought I&#8217;d provide some demo code so that those of you using (or planning to use) Query Store could see how this shows up in your database.<\/p>\n<p><strong>Recreating the issue<\/strong><\/p>\n<p>I started by restoring a copy of the WideWorldImporters database, which you can download <a href=\"https:\/\/github.com\/Microsoft\/sql-server-samples\/tree\/master\/samples\/databases\/wide-world-importers\">here<\/a>.\u00a0 I enabled Query Store and cleared out the data, just as a precaution.<\/p>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">\r\nUSE &#x5B;master];\r\nGO\r\nRESTORE DATABASE &#x5B;WideWorldImporters]\r\nFROM\u00a0 DISK = N'C:\\Backups\\WideWorldImporters-Full.bak' WITH\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]\r\nSET QUERY_STORE = ON;\r\nGO\r\n\r\nALTER DATABASE &#x5B;WideWorldImporters]\r\nSET QUERY_STORE CLEAR;\r\nGO\r\n<\/pre>\n<p>I then created a stored procedure with just one query in it:<\/p>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">\r\nUSE &#x5B;WideWorldImporters];\r\nGO\r\n\r\nCREATE PROCEDURE &#x5B;Sales].&#x5B;usp_GetFullProductInfo]\r\n@StockItemID INT\r\nAS\r\n\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]\r\nON &#x5B;o].&#x5B;OrderID] = &#x5B;ol].&#x5B;OrderID]\r\nWHERE &#x5B;ol].&#x5B;StockItemID] = @StockItemID\r\nORDER BY &#x5B;o].&#x5B;OrderDate] DESC;\r\nGO\r\n<\/pre>\n<p>Then I executed the stored procedure twice, with two different input parameters.\u00a0 I purposely used WITH RECOMPILE here because I knew the values would generate different plans.<\/p>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">\r\nEXEC &#x5B;Sales].&#x5B;usp_GetFullProductInfo] 90 WITH RECOMPILE;\r\nGO\r\n\r\nEXEC &#x5B;Sales].&#x5B;usp_GetFullProductInfo] 224 WITH RECOMPILE;\r\nGO\r\n<\/pre>\n<p>Within Object Explorer I then drilled into the Query Store reports (Databases | WideWorldImporters | Query Store) and double-clicked to run Top Resource Consuming Queries.\u00a0 My query has two different plans:<\/p>\n<figure id=\"attachment_858\" aria-describedby=\"caption-attachment-858\" style=\"width: 1024px\" class=\"wp-caption alignleft\"><a href=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2017\/09\/twoplans.jpg\"><img fetchpriority=\"high\" decoding=\"async\" class=\"wp-image-858 size-large\" src=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2017\/09\/twoplans-1024x243.jpg\" alt=\"Initial query execution, two plans\" width=\"1024\" height=\"243\" srcset=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2017\/09\/twoplans-1024x243.jpg 1024w, https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2017\/09\/twoplans-300x71.jpg 300w, https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2017\/09\/twoplans-900x214.jpg 900w, https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2017\/09\/twoplans.jpg 1858w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption id=\"caption-attachment-858\" class=\"wp-caption-text\">Initial query execution, two plans<\/figcaption><\/figure>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>Plan_id 1 has a clustered index scan with a filter, that feeds into the probe phase of a hash match (with a columnstore index scan for the build). This was generated with the input value of 90.<\/p>\n<figure id=\"attachment_859\" aria-describedby=\"caption-attachment-859\" style=\"width: 833px\" class=\"wp-caption alignleft\"><a href=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2017\/09\/Plan-1.jpg\"><img decoding=\"async\" class=\"wp-image-859 size-full\" src=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2017\/09\/Plan-1.jpg\" alt=\"Plan 1 for query_id 1\" width=\"833\" height=\"254\" srcset=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2017\/09\/Plan-1.jpg 833w, https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2017\/09\/Plan-1-300x91.jpg 300w\" sizes=\"(max-width: 833px) 100vw, 833px\" \/><\/a><figcaption id=\"caption-attachment-859\" class=\"wp-caption-text\">Plan 1 for query_id 1<\/figcaption><\/figure>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>Plan_id 2 has the same columnstore index scan, but it feeds into a nested loop, with a clustered index seek for inner input, and was generated with the input value of 224.<\/p>\n<figure id=\"attachment_872\" aria-describedby=\"caption-attachment-872\" style=\"width: 650px\" class=\"wp-caption alignleft\"><a href=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2017\/09\/plan-2_fixed.jpg\"><img decoding=\"async\" class=\"size-full wp-image-872\" src=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2017\/09\/plan-2_fixed.jpg\" alt=\"Plan 2 for query_id 1\" width=\"650\" height=\"265\" srcset=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2017\/09\/plan-2_fixed.jpg 650w, https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2017\/09\/plan-2_fixed-300x122.jpg 300w\" sizes=\"(max-width: 650px) 100vw, 650px\" \/><\/a><figcaption id=\"caption-attachment-872\" class=\"wp-caption-text\">Plan 2 for query_id 1<\/figcaption><\/figure>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>Now let&#8217;s suppose I decide to force one plan for that query. After analysis, I decide to force the second plan (plan_id 2), which I can do either through the UI, or using a stored procedure. Since change control and documentation is a good thing, we&#8217;ll use the stored procedure:<\/p>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">\r\nEXEC sp_query_store_force_plan @query_id = 3, @plan_id = 8;\r\nGO\r\n<\/pre>\n<p>At this point, if I re-run the stored procedure with the two different input parameters and WITH RECOMPILE, I will get the plan with the nested loop.<\/p>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">\r\nEXEC &#x5B;Sales].&#x5B;usp_GetFullProductInfo] 90 WITH RECOMPILE;\r\nGO\r\n\r\nEXEC &#x5B;Sales].&#x5B;usp_GetFullProductInfo] 224 WITH RECOMPILE;\r\nGO\r\n<\/pre>\n<figure id=\"attachment_861\" aria-describedby=\"caption-attachment-861\" style=\"width: 768px\" class=\"wp-caption alignleft\"><a href=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2017\/09\/forced-plan.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-861 size-full\" src=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2017\/09\/forced-plan.jpg\" alt=\"SP execution after plan is forced\" width=\"768\" height=\"717\" srcset=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2017\/09\/forced-plan.jpg 768w, https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2017\/09\/forced-plan-300x280.jpg 300w\" sizes=\"(max-width: 768px) 100vw, 768px\" \/><\/a><figcaption id=\"caption-attachment-861\" class=\"wp-caption-text\">SP execution after plan is forced<\/figcaption><\/figure>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>Now&#8230;let&#8217;s assume that this forced plan is used going forward and there are no issues. And then let&#8217;s assume that a developer decides to add some comments to the stored procedure, and they know they should use ALTER to keep the object_id the same&#8230;but somehow, a couple extra spaces end up in the query.<\/p>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">\r\nALTER PROCEDURE &#x5B;Sales].&#x5B;usp_GetFullProductInfo]\r\n@StockItemID INT\r\nAS\r\n\/*\r\nThis is getting information based on ID\r\n*may need to add more columns per BL\r\n*\/\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]\r\nON &#x5B;o].&#x5B;OrderID] = &#x5B;ol].&#x5B;OrderID]\r\nWHERE &#x5B;ol].&#x5B;StockItemID] = @StockItemID\r\nORDER BY &#x5B;o].&#x5B;OrderDate] DESC;\r\n\r\nGO\r\n<\/pre>\n<p>I re-run the stored procedures again (WITH RECOMPILE) and now I get that other plan again for the input value of 90:<\/p>\n<figure id=\"attachment_862\" aria-describedby=\"caption-attachment-862\" style=\"width: 941px\" class=\"wp-caption alignleft\"><a href=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2017\/09\/No-longer-forced.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-862 size-full\" src=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2017\/09\/No-longer-forced.jpg\" alt=\"SP execution after ALTER, spaces inadvertenly added\" width=\"941\" height=\"603\" srcset=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2017\/09\/No-longer-forced.jpg 941w, https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2017\/09\/No-longer-forced-300x192.jpg 300w, https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2017\/09\/No-longer-forced-900x577.jpg 900w\" sizes=\"(max-width: 941px) 100vw, 941px\" \/><\/a><figcaption id=\"caption-attachment-862\" class=\"wp-caption-text\">SP execution after ALTER, spaces inadvertenly added<\/figcaption><\/figure>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>If I look in Query Store, I can see I now have two queries that look nearly identical:<\/p>\n<figure id=\"attachment_863\" aria-describedby=\"caption-attachment-863\" style=\"width: 909px\" class=\"wp-caption alignleft\"><a href=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2017\/09\/two-queries.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-863 size-full\" src=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2017\/09\/two-queries.jpg\" alt=\"Two queries in QS after SP was changed\" width=\"909\" height=\"134\" srcset=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2017\/09\/two-queries.jpg 909w, https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2017\/09\/two-queries-300x44.jpg 300w, https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2017\/09\/two-queries-900x133.jpg 900w\" sizes=\"(max-width: 909px) 100vw, 909px\" \/><\/a><figcaption id=\"caption-attachment-863\" class=\"wp-caption-text\">Two queries in QS after SP was changed<\/figcaption><\/figure>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>There are different query_id values in sys.query_store_query, as well as different entries for each query in sys.query_store_query_text. Both queries are still tied to the stored procedure (object_id 1483152329) which can be confusing if you don&#8217;t understand what occurred. In order to confirm which query has executed most recently, you can use the query below, which joins both system views (replace the query_ids as appropriate):<\/p>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">\r\nSELECT\r\n&#x5B;qst].&#x5B;query_text_id],\r\n&#x5B;qst].&#x5B;query_sql_text],\r\n&#x5B;qst].&#x5B;statement_sql_handle],\r\n&#x5B;qs].&#x5B;query_id],\r\n&#x5B;qs].&#x5B;query_hash],\r\n&#x5B;qs].&#x5B;last_execution_time],\r\n&#x5B;qs].&#x5B;object_id]\r\nFROM &#x5B;sys].&#x5B;query_store_query] &#x5B;qs]\r\nJOIN &#x5B;sys].&#x5B;query_store_query_text] &#x5B;qst]\r\nON &#x5B;qs].&#x5B;query_text_id] = &#x5B;qst].&#x5B;query_text_id]\r\nWHERE &#x5B;qs].&#x5B;query_id] IN (1, 14);\r\nGO\r\n<\/pre>\n<figure id=\"attachment_864\" aria-describedby=\"caption-attachment-864\" style=\"width: 1024px\" class=\"wp-caption alignleft\"><a href=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2017\/09\/system-view-output.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-864 size-large\" src=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2017\/09\/system-view-output-1024x59.jpg\" alt=\"Information for both queries from Query Store views\" width=\"1024\" height=\"59\" srcset=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2017\/09\/system-view-output-1024x59.jpg 1024w, https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2017\/09\/system-view-output-300x17.jpg 300w, https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2017\/09\/system-view-output-900x52.jpg 900w, https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2017\/09\/system-view-output.jpg 1828w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption id=\"caption-attachment-864\" class=\"wp-caption-text\">Information for both queries from Query Store views<\/figcaption><\/figure>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Summary<\/strong><\/p>\n<p>The take home message here is that you need to be careful when changing objects (stored procedures, functions) where you have queries with forced plans. Inadvertent changes in spacing or casing create entirely separate queries in Query Store, which means that the original query with a forced plan is no longer in use.\u00a0 You&#8217;ll either have to ALTER the procedure again without the extra spaces in the query (which may not be as easy as it sounds), or get the new version of the query to execute the &#8220;right&#8221; plan, and then force that plan.\u00a0 It may be appropriate to set up monitoring for object changes, or teach your developers how to identify what queries are forced and to what objects they below (hint: use the Queries With Forced Plans report that&#8217;s available in SSMS 17.x). Hope this helps, and if you want to learn more about Query Store, consider my <a href=\"http:\/\/www.pass.org\/summit\/2017\/Sessions\/Details.aspx?sid=66483\">full day pre-con at Summit<\/a> next month where we&#8217;ll cover this type of scenario and a whole lot more! Feel free to reach out if you have questions about it \ud83d\ude42<\/p>\n<p>p.s. did you see that they <a href=\"https:\/\/blogs.technet.microsoft.com\/dataplatforminsider\/2017\/09\/25\/microsoft-for-the-modern-data-estate\/\">announced the release date for SQL Server 2017<\/a>? I&#8217;ll be running that build at my pre-con!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this week&#8217;s Insider newsletter, Paul talked about an interesting customer issue I ran into last week related to Query Store, and an inadvertent change to a query&#8217;s text.\u00a0 I thought I&#8217;d provide some demo code so that those of you using (or planning to use) Query Store could see how this shows up in [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"open","ping_status":"open","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>Changes to query text and the effects in Query Store - Erin Stellato<\/title>\n<meta name=\"description\" content=\"If you&#039;re using Query Store, changing the text of a query can result in a forced plan no longer being used, and potentially a negative change performance.\" \/>\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\/changes-to-query-text-and-the-effects-in-query-store\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Changes to query text and the effects in Query Store - Erin Stellato\" \/>\n<meta property=\"og:description\" content=\"If you&#039;re using Query Store, changing the text of a query can result in a forced plan no longer being used, and potentially a negative change performance.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.sqlskills.com\/blogs\/erin\/changes-to-query-text-and-the-effects-in-query-store\/\" \/>\n<meta property=\"og:site_name\" content=\"Erin Stellato\" \/>\n<meta property=\"article:published_time\" content=\"2017-09-25T19:28:04+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-09-26T15:42:57+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2017\/09\/twoplans-1024x243.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\/changes-to-query-text-and-the-effects-in-query-store\/\",\"url\":\"https:\/\/www.sqlskills.com\/blogs\/erin\/changes-to-query-text-and-the-effects-in-query-store\/\",\"name\":\"Changes to query text and the effects in Query Store - Erin Stellato\",\"isPartOf\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/erin\/#website\"},\"datePublished\":\"2017-09-25T19:28:04+00:00\",\"dateModified\":\"2017-09-26T15:42:57+00:00\",\"author\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/erin\/#\/schema\/person\/76170223ffffa1df03fd9be5b66cb158\"},\"description\":\"If you're using Query Store, changing the text of a query can result in a forced plan no longer being used, and potentially a negative change performance.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/erin\/changes-to-query-text-and-the-effects-in-query-store\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.sqlskills.com\/blogs\/erin\/changes-to-query-text-and-the-effects-in-query-store\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/erin\/changes-to-query-text-and-the-effects-in-query-store\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.sqlskills.com\/blogs\/erin\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Changes to query text and the effects in Query Store\"}]},{\"@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":"Changes to query text and the effects in Query Store - Erin Stellato","description":"If you're using Query Store, changing the text of a query can result in a forced plan no longer being used, and potentially a negative change performance.","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\/changes-to-query-text-and-the-effects-in-query-store\/","og_locale":"en_US","og_type":"article","og_title":"Changes to query text and the effects in Query Store - Erin Stellato","og_description":"If you're using Query Store, changing the text of a query can result in a forced plan no longer being used, and potentially a negative change performance.","og_url":"https:\/\/www.sqlskills.com\/blogs\/erin\/changes-to-query-text-and-the-effects-in-query-store\/","og_site_name":"Erin Stellato","article_published_time":"2017-09-25T19:28:04+00:00","article_modified_time":"2017-09-26T15:42:57+00:00","og_image":[{"url":"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2017\/09\/twoplans-1024x243.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\/changes-to-query-text-and-the-effects-in-query-store\/","url":"https:\/\/www.sqlskills.com\/blogs\/erin\/changes-to-query-text-and-the-effects-in-query-store\/","name":"Changes to query text and the effects in Query Store - Erin Stellato","isPartOf":{"@id":"https:\/\/www.sqlskills.com\/blogs\/erin\/#website"},"datePublished":"2017-09-25T19:28:04+00:00","dateModified":"2017-09-26T15:42:57+00:00","author":{"@id":"https:\/\/www.sqlskills.com\/blogs\/erin\/#\/schema\/person\/76170223ffffa1df03fd9be5b66cb158"},"description":"If you're using Query Store, changing the text of a query can result in a forced plan no longer being used, and potentially a negative change performance.","breadcrumb":{"@id":"https:\/\/www.sqlskills.com\/blogs\/erin\/changes-to-query-text-and-the-effects-in-query-store\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.sqlskills.com\/blogs\/erin\/changes-to-query-text-and-the-effects-in-query-store\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.sqlskills.com\/blogs\/erin\/changes-to-query-text-and-the-effects-in-query-store\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.sqlskills.com\/blogs\/erin\/"},{"@type":"ListItem","position":2,"name":"Changes to query text and the effects in Query Store"}]},{"@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\/857"}],"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=857"}],"version-history":[{"count":0,"href":"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-json\/wp\/v2\/posts\/857\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-json\/wp\/v2\/media?parent=857"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-json\/wp\/v2\/categories?post=857"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-json\/wp\/v2\/tags?post=857"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}