{"id":796,"date":"2017-01-10T07:32:28","date_gmt":"2017-01-10T15:32:28","guid":{"rendered":"http:\/\/3.209.169.194\/blogs\/erin\/?p=796"},"modified":"2018-12-14T09:11:08","modified_gmt":"2018-12-14T17:11:08","slug":"t-sql-tuesday-86-storing-and-accessing-the-query-store-data","status":"publish","type":"post","link":"https:\/\/www.sqlskills.com\/blogs\/erin\/t-sql-tuesday-86-storing-and-accessing-the-query-store-data\/","title":{"rendered":"T-SQL Tuesday #86: Storing and Accessing the Query Store Data"},"content":{"rendered":"<figure id=\"attachment_797\" aria-describedby=\"caption-attachment-797\" style=\"width: 150px\" class=\"wp-caption alignright\"><a href=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2017\/01\/tsql2sday150x150.jpg\"><img decoding=\"async\" class=\"size-full wp-image-797\" src=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2017\/01\/tsql2sday150x150.jpg\" alt=\"T-SQL Tuesday\" width=\"150\" height=\"150\" srcset=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2017\/01\/tsql2sday150x150.jpg 150w, https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2017\/01\/tsql2sday150x150-144x144.jpg 144w\" sizes=\"(max-width: 150px) 100vw, 150px\" \/><\/a><figcaption id=\"caption-attachment-797\" class=\"wp-caption-text\">T-SQL Tuesday<\/figcaption><\/figure>\n<p>The crew over at Brent Ozar Unlimited is hosting <a href=\"https:\/\/www.brentozar.com\/archive\/2017\/01\/announcing-t-sql-tuesday-87-sql-server-bugs-enhancement-requests\/\">this month&#8217;s T-SQL Tuesday<\/a>, and the request was to find an interesting Connect item (bug fix or enhancement request) and write about it.\u00a0 I&#8217;ve been knee-deep in Query Store, and there are two Connect items that immediately came to mind.<\/p>\n<p>One of the primary uses of Query Store is finding query regressions &#8211; that&#8217;s where I start with every presentation and that&#8217;s how it&#8217;s been <a href=\"https:\/\/azure.microsoft.com\/en-us\/blog\/query-store-a-flight-data-recorder-for-your-database\/\">pitched by Microsoft<\/a> from the beginning.\u00a0 And typically we talk about troubleshooting production issues that are happening <em>right now<\/em>, but Query Store is also great for finding regressions and problems <em>before<\/em> you upgrade or make changes.\u00a0 If you run Query Store in production, and have some code changes you want to test, you can restore a backup of production, make changes, then run your queries and use Query Store to do comparisons.\u00a0 But when I start talking about this, I can see people start to think about their own testing process, and they start asking questions&#8230;.<\/p>\n<p style=\"padding-left: 30px;\"><strong>Where does the Query Store data live?<\/strong>\u00a0 In the user database.<\/p>\n<p style=\"padding-left: 30px;\"><strong>Can I change the location of the Query Store data?<\/strong> No, it resides in the PRIMARY filegroup.<\/p>\n<p style=\"padding-left: 30px;\"><strong>Can I export the Query Store data?<\/strong> Technically yes, but it&#8217;s not a supported method.<\/p>\n<p style=\"padding-left: 30px;\"><strong>What if I have sensitive data in Query Store that can&#8217;t exist in a non-Production environment?<\/strong> Just like any restore of a database with sensitive data, you&#8217;re going to have to obfuscate it.<\/p>\n<p>Two of these requests have Connect items, which I&#8217;m listing below.\u00a0 The first allows you to change the location of Query Store data to reside somewhere in the user database besides the PRIMARY filegroup:<\/p>\n<p style=\"padding-left: 30px;\">Option to store query store data in a filegroup other than PRIMARY<\/p>\n<p>The other request is related to exporting that data, which is technically possible now, but it&#8217;s not a supported method so it&#8217;s not something I really want to implement in a client environment.\u00a0 I&#8217;ve had many people describe their process for testing which includes restoring database nightly.\u00a0 If they&#8217;re using Query Store as part of testing, that data is lost every night by the restore.<\/p>\n<p style=\"padding-left: 30px;\">Export Query Store tables separately from the database tables<\/p>\n<p>Find time to up-vote the Connect items you think are most valuable!\u00a0 Haven&#8217;t used Connect before?\u00a0 You just need to <a href=\"https:\/\/signup.live.com\/signup?wa=wsignin1.0&amp;wtrealm=http%3a%2f%2fconnect.microsoft.com&amp;wctx=rm%3d0%26id%3d%26ru%3d%252F%253Flc%253D1033&amp;wct=2017-01-10T15%3a27%3a21Z&amp;wp=urn%3aliveid%3aMBI_FED_SSL_URI&amp;wreply=https%3a%2f%2fconnect.microsoft.com%2fdashboard%2f&amp;contextid=09DE7B441EC5DBCC&amp;bk=1484062047&amp;uaid=d68a118d6f9645bf8023ae6ae7629f18&amp;cru=https%3a%2f%2flogin.live.com%2flogin.srf%3fwa%3dwsignin1.0%26wtrealm%3dhttp%253A%252F%252Fconnect.microsoft.com%26wctx%3drm%253D0%2526id%253D%2526ru%253D%25252F%25253Flc%25253D1033%26wct%3d2017-01-10T15%253A27%253A21Z%26wp%3durn%253Aliveid%253AMBI_FED_SSL_URI%26wreply%3dhttps%253A%252F%252Fconnect.microsoft.com%252Fdashboard%252F%26contextid%3d09DE7B441EC5DBCC&amp;mkt=EN-US&amp;lc=1033&amp;sl=1&amp;lic=1\">create a Microsoft account<\/a> (it&#8217;s free) and then you can vote.\u00a0 If you use SQL Server on a daily basis, I expect you&#8217;d like provide input into the development of the product you&#8217;re supporting.\u00a0 Have fun!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The crew over at Brent Ozar Unlimited is hosting this month&#8217;s T-SQL Tuesday, and the request was to find an interesting Connect item (bug fix or enhancement request) and write about it.\u00a0 I&#8217;ve been knee-deep in Query Store, and there are two Connect items that immediately came to mind. One of the primary uses of [&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>T-SQL Tuesday #86: Storing and Accessing the Query Store Data - Erin Stellato<\/title>\n<meta name=\"description\" content=\"There is currently no way to modify where Query Store data is stored, and no way to export it. Check out these two Connect items that could change that!\" \/>\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\/t-sql-tuesday-86-storing-and-accessing-the-query-store-data\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"T-SQL Tuesday #86: Storing and Accessing the Query Store Data - Erin Stellato\" \/>\n<meta property=\"og:description\" content=\"There is currently no way to modify where Query Store data is stored, and no way to export it. Check out these two Connect items that could change that!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.sqlskills.com\/blogs\/erin\/t-sql-tuesday-86-storing-and-accessing-the-query-store-data\/\" \/>\n<meta property=\"og:site_name\" content=\"Erin Stellato\" \/>\n<meta property=\"article:published_time\" content=\"2017-01-10T15:32:28+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-12-14T17:11:08+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2017\/01\/tsql2sday150x150.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=\"2 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\/t-sql-tuesday-86-storing-and-accessing-the-query-store-data\/\",\"url\":\"https:\/\/www.sqlskills.com\/blogs\/erin\/t-sql-tuesday-86-storing-and-accessing-the-query-store-data\/\",\"name\":\"T-SQL Tuesday #86: Storing and Accessing the Query Store Data - Erin Stellato\",\"isPartOf\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/erin\/#website\"},\"datePublished\":\"2017-01-10T15:32:28+00:00\",\"dateModified\":\"2018-12-14T17:11:08+00:00\",\"author\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/erin\/#\/schema\/person\/76170223ffffa1df03fd9be5b66cb158\"},\"description\":\"There is currently no way to modify where Query Store data is stored, and no way to export it. Check out these two Connect items that could change that!\",\"breadcrumb\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/erin\/t-sql-tuesday-86-storing-and-accessing-the-query-store-data\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.sqlskills.com\/blogs\/erin\/t-sql-tuesday-86-storing-and-accessing-the-query-store-data\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/erin\/t-sql-tuesday-86-storing-and-accessing-the-query-store-data\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.sqlskills.com\/blogs\/erin\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"T-SQL Tuesday #86: Storing and Accessing the Query Store Data\"}]},{\"@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":"T-SQL Tuesday #86: Storing and Accessing the Query Store Data - Erin Stellato","description":"There is currently no way to modify where Query Store data is stored, and no way to export it. Check out these two Connect items that could change that!","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\/t-sql-tuesday-86-storing-and-accessing-the-query-store-data\/","og_locale":"en_US","og_type":"article","og_title":"T-SQL Tuesday #86: Storing and Accessing the Query Store Data - Erin Stellato","og_description":"There is currently no way to modify where Query Store data is stored, and no way to export it. Check out these two Connect items that could change that!","og_url":"https:\/\/www.sqlskills.com\/blogs\/erin\/t-sql-tuesday-86-storing-and-accessing-the-query-store-data\/","og_site_name":"Erin Stellato","article_published_time":"2017-01-10T15:32:28+00:00","article_modified_time":"2018-12-14T17:11:08+00:00","og_image":[{"url":"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-content\/uploads\/2017\/01\/tsql2sday150x150.jpg"}],"author":"Erin Stellato","twitter_misc":{"Written by":"Erin Stellato","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.sqlskills.com\/blogs\/erin\/t-sql-tuesday-86-storing-and-accessing-the-query-store-data\/","url":"https:\/\/www.sqlskills.com\/blogs\/erin\/t-sql-tuesday-86-storing-and-accessing-the-query-store-data\/","name":"T-SQL Tuesday #86: Storing and Accessing the Query Store Data - Erin Stellato","isPartOf":{"@id":"https:\/\/www.sqlskills.com\/blogs\/erin\/#website"},"datePublished":"2017-01-10T15:32:28+00:00","dateModified":"2018-12-14T17:11:08+00:00","author":{"@id":"https:\/\/www.sqlskills.com\/blogs\/erin\/#\/schema\/person\/76170223ffffa1df03fd9be5b66cb158"},"description":"There is currently no way to modify where Query Store data is stored, and no way to export it. Check out these two Connect items that could change that!","breadcrumb":{"@id":"https:\/\/www.sqlskills.com\/blogs\/erin\/t-sql-tuesday-86-storing-and-accessing-the-query-store-data\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.sqlskills.com\/blogs\/erin\/t-sql-tuesday-86-storing-and-accessing-the-query-store-data\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.sqlskills.com\/blogs\/erin\/t-sql-tuesday-86-storing-and-accessing-the-query-store-data\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.sqlskills.com\/blogs\/erin\/"},{"@type":"ListItem","position":2,"name":"T-SQL Tuesday #86: Storing and Accessing the Query Store Data"}]},{"@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\/796"}],"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=796"}],"version-history":[{"count":0,"href":"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-json\/wp\/v2\/posts\/796\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-json\/wp\/v2\/media?parent=796"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-json\/wp\/v2\/categories?post=796"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/erin\/wp-json\/wp\/v2\/tags?post=796"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}