{"id":17176,"date":"2022-04-22T06:50:03","date_gmt":"2022-04-22T04:50:03","guid":{"rendered":"https:\/\/www.dbi-services.com\/blog\/sql-server-find-who-forced-a-plan-in-query-store-with-this-new-xevent\/"},"modified":"2025-10-01T12:02:17","modified_gmt":"2025-10-01T10:02:17","slug":"sql-server-find-who-forced-a-plan-in-query-store-with-this-new-xevent","status":"publish","type":"post","link":"https:\/\/www.dbi-services.com\/blog\/sql-server-find-who-forced-a-plan-in-query-store-with-this-new-xevent\/","title":{"rendered":"SQL Server: Find who forced a plan in Query Store with this new XEvent"},"content":{"rendered":"<p>The latest Cumulative Update for SQL Server 2019 has been released this week on Monday. It brings many bug fixes and some small improvements.<br \/>\nOne of these improvements is the addition of an <a href=\"https:\/\/docs.microsoft.com\/en-us\/sql\/relational-databases\/extended-events\/extended-events?view=sql-server-ver15\">extended event<\/a> to identify the users forcing or unforcing an execution plan via the Query Store.<\/p>\n<p>In this blog post, I will test this new XEvent.<\/p>\n<p>For details about the latest CU see: <a href=\"https:\/\/support.microsoft.com\/en-us\/topic\/kb5011644-cumulative-update-16-for-sql-server-2019-74377be1-4340-4445-93a7-ff843d346896\">KB5011644 &#8211; Cumulative Update 16 for SQL Server 2019<\/a><br \/>\nThere is a tiny KB dedicated for this new XEvent, see: <a href=\"https:\/\/support.microsoft.com\/en-us\/topic\/kb5012964-improvement-add-an-xevent-for-tracking-manual-user-plan-forcing-and-unforcing-d09f4766-c40c-44bf-a8cb-93250aeb8826\">KB5012964 &#8211; Improvement: Add an XEvent for tracking manual user plan forcing and unforcing<\/a><\/p>\n<p>What this new event does is very simple, and it&#8217;s what is described in its KB:<\/p>\n<blockquote><p>An Extended Event (XEvent), <b class=\"ocpLegacyBold\">query_store_plan_forcing_user_change<\/b>,&nbsp;is added to optionally track when users manually force or unforce&nbsp;a plan&nbsp;for a particular query&nbsp;in the Query Store.<\/p><\/blockquote>\n<h4>Query Store Extended Events<\/h4>\n<p>This new event is added to an already well-stocked list of extended events available around the Query Store.<br \/>\nThe following query lists 85 XEvents.<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">SELECT o.name         AS [Object-Name]\n\t, o.description  AS [Object-Descr]\nFROM sys.dm_xe_packages AS p\n\tJOIN  sys.dm_xe_objects AS o\n\t\tON p.guid = o.package_guid\nWHERE o.object_type = 'event'\n  AND p.name = 'qds'\n  AND o.name LIKE '%query_store%'<\/pre>\n<p><a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Blog29_QS_events-1.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-55401 aligncenter\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Blog29_QS_events-1.jpg\" alt=\"\" width=\"808\" height=\"594\"><\/a><\/p>\n<p>The new extended event, <b class=\"ocpLegacyBold\">query_store_plan_forcing_user_change<\/b>, comes with a few fields related to the plan being forced, the query, and most importantly the &#8220;is_forced_plan&#8221; field.<br \/>\nWhen a plan is forced it is set to True. It is set to false when the user unforce a plan.<a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Blog29_1_XE_event.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-55390 aligncenter\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Blog29_1_XE_event.jpg\" alt=\"\" width=\"932\" height=\"539\"><\/a><\/p>\n<h4>Parameter Sensitive plan (parameter sniffing) demo<\/h4>\n<p>To test this extended event here is a simple demo of parameter sniffing using the AdventureWorks database.<\/p>\n<p>Here is the preparation script if you want to follow along:<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">ALTER DATABASE AdventureWorks SET QUERY_STORE = ON;\ngo\n\nuse [AdventureWorks]\ngo\n\nDROP PROC IF EXISTS dbo.GetAverageSalary;\nDROP TABLE IF EXISTS dbo.Employees;\ngo\ncreate table dbo.Employees (\n\tID int not null,\n\tNumber varchar(32) not null,\n\tName varchar(100) not null,\n\tSalary money not null,\n\tCountry varchar(64) not null,\n\tconstraint PK_Employees\tprimary key clustered(ID)\n);\n\n;with N1(C) as (select 0 union all select 0) -- 2 rows\n\t,N2(C) as (select 0 from N1 as T1 cross join N1 as T2) -- 4 rows\n\t,N3(C) as (select 0 from N2 as T1 cross join N2 as T2) -- 16 rows\n\t,N4(C) as (select 0 from N3 as T1 cross join N3 as T2) -- 256 rows\n\t,N5(C) as (select 0 from N4 as T1 cross join N4 as T2 ) -- 65,536 rows\n\t,Nums(Num) as (select row_number() over (order by (select null)) from N5)\ninsert into dbo.Employees(ID, Number, Name, Salary, Country)\n\tselect \n\t\tNum, \n\t\tconvert(varchar(5),Num), \n\t\t'USA Employee: ' + convert(varchar(5),Num), \n\t\t40000,\n\t\t'USA'\n\tfrom Nums;\n\n;with N1(C) as (select 0 union all select 0) -- 2 rows\n\t,N2(C) as (select 0 from N1 as T1 cross join N1 as T2) -- 4 rows\n\t,N3(C) as (select 0 from N2 as T1 cross join N2 as T2) -- 16 rows\n\t,Nums(Num) as (select row_number() over (order by (select null)) from N3)\ninsert into dbo.Employees(ID, Number, Name, Salary, Country)\n\tselect \n\t\t65536 + Num, \n\t\tconvert(varchar(5),65536 + Num), \n\t\t'Switzerland Employee: ' + convert(varchar(5),Num), \n\t\t40000,\n\t\t'Switzerland'\n\tfrom Nums;\n\ncreate nonclustered index IDX_Employees_Country\non dbo.Employees(Country);\ngo\n\ncreate proc dbo.GetAverageSalary @Country varchar(64)\nas\n\tselect Avg(Salary) as [Avg Salary]\n\tfrom dbo.Employees\n\twhere Country = @Country;\ngo<\/pre>\n<p>This is a very basic employees table with a Salary column and a Country column.<br \/>\nTo create a parameter sniffing scenario I have inserted way more employees in the USA than in Switzerland.<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">select Count(*) AS nbEmployees, Country\nfrom dbo.Employees\ngroup by Country;<\/pre>\n<p><a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Blog29_EmployeesPerCountry_result.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-55414 aligncenter\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Blog29_EmployeesPerCountry_result.jpg\" alt=\"\" width=\"262\" height=\"81\"><\/a><\/p>\n<p>So when executing the stored procedure alternating the two countries for the @Country parameter associated with a plan cache eviction (forced with the CLEAR PROCEDURE_CACHE command) we create a parameter sniffing scenario.<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">alter database scoped configuration clear procedure_cache\ngo\nexec dbo.GetAverageSalary @Country='USA';\nexec dbo.GetAverageSalary @Country='Switzerland';\ngo 50\n\nalter database scoped configuration clear procedure_cache\ngo\nexec dbo.GetAverageSalary @Country='Switzerland';\nexec dbo.GetAverageSalary @Country='USA';\ngo 50<\/pre>\n<p>Looking at the Query Store we have 2 execution plans for the same query.<br \/>\nThe first plan is an index Scan, it&#8217;s best for larger data sets like the USA parameter, and it&#8217;s fine for the Switzerland parameter.<a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Blog29_3_Parameter_Sniffing_Scan-1.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-55408 aligncenter\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Blog29_3_Parameter_Sniffing_Scan-1.jpg\" alt=\"\" width=\"1169\" height=\"531\"><\/a><\/p>\n<p>The second plan is to use a Nest Loops, it&#8217;s the best plan for a small result set, so the Switzerland parameter, but it&#8217;s a disaster performance-wise for a larger number of rows like the USA parameter.<a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Blog29_2_Parameter_Sniffing_NestedLoop-1.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-55407 aligncenter\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Blog29_2_Parameter_Sniffing_NestedLoop-1.jpg\" alt=\"\" width=\"1166\" height=\"591\"><\/a><\/p>\n<p>In such cases, one might want to force the first plan (with a Scan) for all parameters.<\/p>\n<h4>Forcing a plan<\/h4>\n<p>A plan can be forced with the following stored procedure or using the SSMS built-in report.<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">exec sp_query_store_force_plan \n\t@query_id = 1\n\t, @plan_id = 1;<\/pre>\n<p>So I did force the plan manually.<a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Blog29_7_plan_forced_2-1.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-55422 aligncenter\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Blog29_7_plan_forced_2-1.jpg\" alt=\"\" width=\"658\" height=\"382\"><\/a><\/p>\n<h4>The Extended Event<\/h4>\n<p>We can retrieve from the Extended Event the query_id, plan_id, and the is_forced_plan field.<\/p>\n<p>We know who has changed forced a plan (hostname, username, etc.), what plan it is, and for what query.<a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Blog29_XE_Forced.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-55418 aligncenter\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Blog29_XE_Forced.jpg\" alt=\"\" width=\"1474\" height=\"123\"><\/a><\/p>\n<p>Same thing for Unforcing a plan:<a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Blog29_XE_UnForced.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-55419 aligncenter\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Blog29_XE_UnForced.jpg\" alt=\"\" width=\"1476\" height=\"143\"><\/a><\/p>\n<h4>Is it working with automatic tuning?<\/h4>\n<p>I enabled the automatic tuning feature which forces the last known good plan automatically.<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">ALTER DATABASE AdventureWorks\n\tSET AUTOMATIC_TUNING (FORCE_LAST_GOOD_PLAN = ON);<\/pre>\n<p>It successfully force the best plan for that query but did not fire the XEvent. As the name and the description mention, it only applies to <strong>user<\/strong>-triggered changes.<br \/>\nI am not aware of another XEvent which can collect the fact a plan has been forced by the Automatic Tuning and I think this is something that should also be available.<\/p>\n<p>To get this information I think we have no choice but to use the <a href=\"https:\/\/docs.microsoft.com\/en-us\/sql\/relational-databases\/system-catalog-views\/sys-query-store-plan-transact-sql?view=sql-server-ver15\">sys.query_store_plan<\/a> DMV.<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">use AdventureWorks\ngo\nselect plan_id, query_id, query_plan_hash\n\t, is_forced_plan\n\t, plan_forcing_type_desc\nfrom sys.query_store_plan<\/pre>\n<p><a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Blog29_10_plan_forcing_type_automatic-1.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-55425 aligncenter\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Blog29_10_plan_forcing_type_automatic-1.jpg\" alt=\"\" width=\"669\" height=\"201\"><\/a><\/p>\n<h4>Querying the XE<\/h4>\n<p>The XEvent data can be queried in SQL to be joined with DMVs to retrieve the query text for example:<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">use AdventureWorks\ngo\n;WITH cte AS (\n\tSELECT\n\t\tevent_data.value(N'(event\/@timestamp)[1]', N'datetime') AS EventDatetime\n\t\t, event_data.value('(\/event\/action[@name=''database_name'']\/value)[1]','varchar(200)') AS [DatabaseName]\n\t\t, event_data.value('(\/event\/data[@name=''query_hash'']\/value)[1]','varchar(200)') AS query_hash\n\t\t, event_data.value('(\/event\/data[@name=''plan_id'']\/value)[1]','int') AS plan_id\n\t\t, event_data.value('(\/event\/data[@name=''query_id'']\/value)[1]','int') AS query_id\n\t\t, event_data.value('(\/event\/data[@name=''is_forced_plan'']\/value)[1]','varchar(max)') AS is_forced_plan\n\t\t, event_data.value('(\/event\/action[@name=''username'']\/value)[1]','varchar(200)') AS username\n\t\t, event_data.value('(\/event\/action[@name=''client_hostname'']\/value)[1]','varchar(200)') AS client_hostname\n\t\t, event_data.value('(\/event\/action[@name=''client_app_name'']\/value)[1]','varchar(200)') AS client_app_name\n\tFROM (\n\t\tSELECT CAST(event_data as xml) AS event_data\n\t\tFROM sys.fn_xe_file_target_read_file('query_store_plan_forcing_user_change*.xel', null, null, null)\n\t) AS xe\n)\nSELECT\n\tcte.EventDatetime\n\t, cte.DatabaseName\n\t, cte.is_forced_plan\n\t, cte.username\n\t, cte.client_hostname\n\t, cte.client_app_name\n\t, t.query_sql_text\n\t, CAST(p.query_plan AS XML) AS query_plan\nFROM cte\n\tJOIN sys.query_store_query AS q\n\t\ton cte.query_id = q.query_id\n\tJOIN sys.query_store_query_text AS t\n\t\ton t.query_text_id = q.query_text_id\n\tJOIN sys.query_store_plan AS p\n\t\tON q.query_id = p.query_id\n\t\tAND cte.plan_id = p.plan_id\nORDER BY cte.EventDatetime DESC<\/pre>\n<p><a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Blog29_DMV_Query.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-55433\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Blog29_DMV_Query.jpg\" alt=\"\" width=\"1781\" height=\"105\"><\/a><\/p>\n<h4>Conclusion<\/h4>\n<p>Microsoft may periodically add enhancements to SQL Server without waiting for a major version change, through Cumulative Updates.<br \/>\nIn this blog post, I tested an extended event that was just added with CU16 for SQL Server 2019.<br \/>\nThis new XEvent could be used to monitor the forcing of plans on your databases and identify who made the change when several DBAs or Developers can perform this type of action in your environment.<\/p>\n\n\n<p>Written by <a href=\"https:\/\/www.linkedin.com\/in\/steven-naudet-aa540158\/\">Steven Naudet<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The latest Cumulative Update for SQL Server 2019 has been released this week on Monday. It brings many bug fixes and some small improvements. One of these improvements is the addition of an extended event to identify the users forcing or unforcing an execution plan via the Query Store. In this blog post, I will [&hellip;]<\/p>\n","protected":false},"author":26,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[229,99],"tags":[2543,2544,688,51,2545],"type_dbi":[],"class_list":["post-17176","post","type-post","status-publish","format-standard","hentry","category-database-administration-monitoring","category-sql-server","tag-cu16","tag-plan-forcing","tag-query-store","tag-sql-server","tag-xevent"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.2 (Yoast SEO v27.2) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>SQL Server: Find who forced a plan in Query Store with this new XEvent - dbi Blog<\/title>\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.dbi-services.com\/blog\/sql-server-find-who-forced-a-plan-in-query-store-with-this-new-xevent\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SQL Server: Find who forced a plan in Query Store with this new XEvent\" \/>\n<meta property=\"og:description\" content=\"The latest Cumulative Update for SQL Server 2019 has been released this week on Monday. It brings many bug fixes and some small improvements. One of these improvements is the addition of an extended event to identify the users forcing or unforcing an execution plan via the Query Store. In this blog post, I will [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.dbi-services.com\/blog\/sql-server-find-who-forced-a-plan-in-query-store-with-this-new-xevent\/\" \/>\n<meta property=\"og:site_name\" content=\"dbi Blog\" \/>\n<meta property=\"article:published_time\" content=\"2022-04-22T04:50:03+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-10-01T10:02:17+00:00\" \/>\n<meta name=\"author\" content=\"Microsoft Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Microsoft Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/sql-server-find-who-forced-a-plan-in-query-store-with-this-new-xevent\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/sql-server-find-who-forced-a-plan-in-query-store-with-this-new-xevent\/\"},\"author\":{\"name\":\"Microsoft Team\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/bfab48333280d616e1170e7369df90a4\"},\"headline\":\"SQL Server: Find who forced a plan in Query Store with this new XEvent\",\"datePublished\":\"2022-04-22T04:50:03+00:00\",\"dateModified\":\"2025-10-01T10:02:17+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/sql-server-find-who-forced-a-plan-in-query-store-with-this-new-xevent\/\"},\"wordCount\":707,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/sql-server-find-who-forced-a-plan-in-query-store-with-this-new-xevent\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Blog29_QS_events-1.jpg\",\"keywords\":[\"CU16\",\"Plan forcing\",\"query store\",\"SQL Server\",\"XEvent\"],\"articleSection\":[\"Database Administration &amp; Monitoring\",\"SQL Server\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/sql-server-find-who-forced-a-plan-in-query-store-with-this-new-xevent\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/sql-server-find-who-forced-a-plan-in-query-store-with-this-new-xevent\/\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/sql-server-find-who-forced-a-plan-in-query-store-with-this-new-xevent\/\",\"name\":\"SQL Server: Find who forced a plan in Query Store with this new XEvent - dbi Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/sql-server-find-who-forced-a-plan-in-query-store-with-this-new-xevent\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/sql-server-find-who-forced-a-plan-in-query-store-with-this-new-xevent\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Blog29_QS_events-1.jpg\",\"datePublished\":\"2022-04-22T04:50:03+00:00\",\"dateModified\":\"2025-10-01T10:02:17+00:00\",\"author\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/bfab48333280d616e1170e7369df90a4\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/sql-server-find-who-forced-a-plan-in-query-store-with-this-new-xevent\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/sql-server-find-who-forced-a-plan-in-query-store-with-this-new-xevent\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/sql-server-find-who-forced-a-plan-in-query-store-with-this-new-xevent\/#primaryimage\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Blog29_QS_events-1.jpg\",\"contentUrl\":\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Blog29_QS_events-1.jpg\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/sql-server-find-who-forced-a-plan-in-query-store-with-this-new-xevent\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\/\/www.dbi-services.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SQL Server: Find who forced a plan in Query Store with this new XEvent\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#website\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/\",\"name\":\"dbi Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/bfab48333280d616e1170e7369df90a4\",\"name\":\"Microsoft Team\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/c44a1a792c059f24055763aa77d80a244467f6eef724a8bd13db8d4a350b7a4c?s=96&d=mm&r=g\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/c44a1a792c059f24055763aa77d80a244467f6eef724a8bd13db8d4a350b7a4c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/c44a1a792c059f24055763aa77d80a244467f6eef724a8bd13db8d4a350b7a4c?s=96&d=mm&r=g\",\"caption\":\"Microsoft Team\"},\"url\":\"https:\/\/www.dbi-services.com\/blog\/author\/microsoft-team\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"SQL Server: Find who forced a plan in Query Store with this new XEvent - dbi Blog","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.dbi-services.com\/blog\/sql-server-find-who-forced-a-plan-in-query-store-with-this-new-xevent\/","og_locale":"en_US","og_type":"article","og_title":"SQL Server: Find who forced a plan in Query Store with this new XEvent","og_description":"The latest Cumulative Update for SQL Server 2019 has been released this week on Monday. It brings many bug fixes and some small improvements. One of these improvements is the addition of an extended event to identify the users forcing or unforcing an execution plan via the Query Store. In this blog post, I will [&hellip;]","og_url":"https:\/\/www.dbi-services.com\/blog\/sql-server-find-who-forced-a-plan-in-query-store-with-this-new-xevent\/","og_site_name":"dbi Blog","article_published_time":"2022-04-22T04:50:03+00:00","article_modified_time":"2025-10-01T10:02:17+00:00","author":"Microsoft Team","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Microsoft Team","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-find-who-forced-a-plan-in-query-store-with-this-new-xevent\/#article","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-find-who-forced-a-plan-in-query-store-with-this-new-xevent\/"},"author":{"name":"Microsoft Team","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/bfab48333280d616e1170e7369df90a4"},"headline":"SQL Server: Find who forced a plan in Query Store with this new XEvent","datePublished":"2022-04-22T04:50:03+00:00","dateModified":"2025-10-01T10:02:17+00:00","mainEntityOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-find-who-forced-a-plan-in-query-store-with-this-new-xevent\/"},"wordCount":707,"commentCount":0,"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-find-who-forced-a-plan-in-query-store-with-this-new-xevent\/#primaryimage"},"thumbnailUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Blog29_QS_events-1.jpg","keywords":["CU16","Plan forcing","query store","SQL Server","XEvent"],"articleSection":["Database Administration &amp; Monitoring","SQL Server"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.dbi-services.com\/blog\/sql-server-find-who-forced-a-plan-in-query-store-with-this-new-xevent\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-find-who-forced-a-plan-in-query-store-with-this-new-xevent\/","url":"https:\/\/www.dbi-services.com\/blog\/sql-server-find-who-forced-a-plan-in-query-store-with-this-new-xevent\/","name":"SQL Server: Find who forced a plan in Query Store with this new XEvent - dbi Blog","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-find-who-forced-a-plan-in-query-store-with-this-new-xevent\/#primaryimage"},"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-find-who-forced-a-plan-in-query-store-with-this-new-xevent\/#primaryimage"},"thumbnailUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Blog29_QS_events-1.jpg","datePublished":"2022-04-22T04:50:03+00:00","dateModified":"2025-10-01T10:02:17+00:00","author":{"@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/bfab48333280d616e1170e7369df90a4"},"breadcrumb":{"@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-find-who-forced-a-plan-in-query-store-with-this-new-xevent\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.dbi-services.com\/blog\/sql-server-find-who-forced-a-plan-in-query-store-with-this-new-xevent\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-find-who-forced-a-plan-in-query-store-with-this-new-xevent\/#primaryimage","url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Blog29_QS_events-1.jpg","contentUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Blog29_QS_events-1.jpg"},{"@type":"BreadcrumbList","@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-find-who-forced-a-plan-in-query-store-with-this-new-xevent\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/www.dbi-services.com\/blog\/"},{"@type":"ListItem","position":2,"name":"SQL Server: Find who forced a plan in Query Store with this new XEvent"}]},{"@type":"WebSite","@id":"https:\/\/www.dbi-services.com\/blog\/#website","url":"https:\/\/www.dbi-services.com\/blog\/","name":"dbi Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/bfab48333280d616e1170e7369df90a4","name":"Microsoft Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/c44a1a792c059f24055763aa77d80a244467f6eef724a8bd13db8d4a350b7a4c?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/c44a1a792c059f24055763aa77d80a244467f6eef724a8bd13db8d4a350b7a4c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c44a1a792c059f24055763aa77d80a244467f6eef724a8bd13db8d4a350b7a4c?s=96&d=mm&r=g","caption":"Microsoft Team"},"url":"https:\/\/www.dbi-services.com\/blog\/author\/microsoft-team\/"}]}},"_links":{"self":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/17176","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/users\/26"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/comments?post=17176"}],"version-history":[{"count":3,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/17176\/revisions"}],"predecessor-version":[{"id":40618,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/17176\/revisions\/40618"}],"wp:attachment":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media?parent=17176"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/categories?post=17176"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/tags?post=17176"},{"taxonomy":"type","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/type_dbi?post=17176"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}