{"id":29418,"date":"2023-11-20T15:20:53","date_gmt":"2023-11-20T14:20:53","guid":{"rendered":"https:\/\/www.dbi-services.com\/blog\/?p=29418"},"modified":"2023-11-20T15:21:30","modified_gmt":"2023-11-20T14:21:30","slug":"boost-dynamic-sql-with-plan-guide","status":"publish","type":"post","link":"https:\/\/www.dbi-services.com\/blog\/boost-dynamic-sql-with-plan-guide\/","title":{"rendered":"Boost dynamic SQL with Plan Guides"},"content":{"rendered":"\n<p>Recently a customer asked me to check why a load process from a banking application has so poor performance.<br>In fact this process is extremely slow, between 40 minutes up to more than one hour to load around 240&#8217;000 rows. As the application is a black box for my customer I have first to find out which queries are running during this process, which ones are the most time consuming and why.<\/p>\n\n\n\n<p>To find out which queries are running against your instance or a specific database you have multiples solutions going from the &#8220;old school&#8221;  SQL Server Profiler to a more recent one the Extended Event sessions and even the Query Store which can help. In my case the Query Store was not enable, my customer is running SQL Server 2016 Enterprise Edition, so I started it.<br>I created an Extended Event session where I selected the rpc_completed event and started it during the load process.<br>I quickly found out the guilty query which was a classical parameterized Dynamic SQL executed with sp_executesql.<\/p>\n\n\n\n<p>The script is looking as follow:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>exec sp_executesql N'SELECT ...... FROM ..... WHERE ..... GROUP BY ..... ORDER BY .....' ,N'@P0 date,@P1 date,@P2 date','2023-10-20','1900-01-01','2023-10-27'<\/code><\/pre>\n\n\n\n<p>When I ran it on my Management studio with the same parameters the duration was around 35 minutes to retrieve 6200 rows (another query runs after this one to load the 240&#8217;000 based on those ones but this query is fast enough):<\/p>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-2 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"441\" data-id=\"29420\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/11\/PlanGuide_1-1024x441.jpg\" alt=\"\" class=\"wp-image-29420\" srcset=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/11\/PlanGuide_1-1024x441.jpg 1024w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/11\/PlanGuide_1-300x129.jpg 300w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/11\/PlanGuide_1-768x331.jpg 768w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/11\/PlanGuide_1-1536x662.jpg 1536w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/11\/PlanGuide_1-2048x882.jpg 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/figure>\n\n\n\n<p>If I check in my Query Store for the Top Resource Consumers for my database, I can find my query:<\/p>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-3 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"360\" data-id=\"29422\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/11\/PlanGuide_2-1024x360.jpg\" alt=\"\" class=\"wp-image-29422\" srcset=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/11\/PlanGuide_2-1024x360.jpg 1024w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/11\/PlanGuide_2-300x105.jpg 300w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/11\/PlanGuide_2-768x270.jpg 768w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/11\/PlanGuide_2-1536x540.jpg 1536w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/11\/PlanGuide_2-2048x720.jpg 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/figure>\n\n\n\n<p>Now the question is: &#8220;How can I boost this query?&#8221;.<br>By chance I followed last year a SQL Bits session from <a href=\"https:\/\/erikdarling.com\/\">Erik Darling<\/a> about Performance Tuning and Parameter Sniffing.<br>During its session Erik spoke about the possibility to use the hint OPTIMIZE FOR.<br>Here as I have three parameters I will use the hint OPTIMIZE FOR UNKNOWN which will tell SQL Server to make a blind assumption to completely kill parameter sniffing for my three parameters.<br>My new script will look like:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><code>exec sp_executesql N'SELECT ...... FROM ..... WHERE ..... GROUP BY ..... ORDER BY ..... <strong>OPTION (OPTIMIZE FOR UNKNOWN)<\/strong>' ,N'@P0 date,@P1 date,@P2 date','2023-10-20','1900-01-01','2023-10-27'<\/code><\/code><\/pre>\n\n\n\n<p>When I execute my script now, the magic happens, the time to execute the query is now less than 5 seconds:<\/p>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-4 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"367\" data-id=\"29426\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/11\/PlanGuide_3-1024x367.jpg\" alt=\"\" class=\"wp-image-29426\" srcset=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/11\/PlanGuide_3-1024x367.jpg 1024w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/11\/PlanGuide_3-300x108.jpg 300w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/11\/PlanGuide_3-768x275.jpg 768w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/11\/PlanGuide_3-1536x550.jpg 1536w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/11\/PlanGuide_3-2048x734.jpg 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/figure>\n\n\n\n<p>The tricky part is that the query is generated automatically by the application which is not developed in house, so how can I add my hint to the query?<br>With SQL Server 2022 and the possibility to add <a href=\"https:\/\/learn.microsoft.com\/en-us\/sql\/relational-databases\/performance\/query-store-hints\">hints via the Query Store<\/a> the task would have been easy but with SQL Server 2016 it&#8217;s not an option.<\/p>\n\n\n\n<p>The solution here is the Plan Guides. <br>Plan guides give the possibility to optimize the performance of queries when there is no possibility to directly change the text of the actual query in SQL Server. Plan Guides force the optimization of queries by adding query hints or a fixed query plan to them. They can be used when queries coming from applications provided by a third-party vendor are not performing as expected. <br>In the Plan Guide, you need to mention the T-SQL statement that you need to optimize and add an OPTION clause where you define the query hints you want to use or a specific query plan you want to use to optimize the query. During execution of the query, SQL Server will match the T-SQL statement of the query to the Plan Guide and will attach the OPTION clause to the query at run time or will use the specified query plan.<\/p>\n\n\n\n<p>When we create the Plan Guide, the used T-SQL must exactly match the one provided by the third party application. This query has to be the same as the SQL Server compiler receives. Microsoft advises to use the SQL Server Profiler to capture the actual batch and parameter text. If there are some difference the Plan Guide won&#8217;t be used.<br>Before to know this point, I tried to use the T-SQL text coming from the Query Store or coming from the DMVs sys.dm_exec_sql_text but created Plan Guides were never used during the execution of the query from the application. To avoid to waste time please follow this <a href=\"https:\/\/learn.microsoft.com\/en-us\/sql\/relational-databases\/performance\/use-sql-server-profiler-to-create-and-test-plan-guides?view=sql-server-ver16\">Microsoft guide<\/a>.<\/p>\n\n\n\n<p>Once you have your T-SQL statement you can create your Plan Guide with the <a href=\"https:\/\/learn.microsoft.com\/en-us\/sql\/relational-databases\/system-stored-procedures\/sp-create-plan-guide-transact-sql?view=sql-server-ver16\">sp_create_plan_guide<\/a> Stored Procedure.<br>My one looks like that:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>EXEC sp_create_plan_guide \n@name = N'&lt;database_name&gt; plan guide with hint SQL coming from profiler', \n@stmt = N'the T-SQL catches with my SQL Server Profiler',\n@type = N'SQL',\n@params = N'@P0 date,@P1 date,@P2 date',\n@hints = N'OPTION (OPTIMIZE FOR UNKNOWN)'\nGO<\/code><\/pre>\n\n\n\n<p>Once created you can see your new Plan Guides on SSMS:<\/p>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-5 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"425\" height=\"398\" data-id=\"29463\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/11\/PlanGuide_4.jpg\" alt=\"\" class=\"wp-image-29463\" srcset=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/11\/PlanGuide_4.jpg 425w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/11\/PlanGuide_4-300x281.jpg 300w\" sizes=\"auto, (max-width: 425px) 100vw, 425px\" \/><\/figure>\n<\/figure>\n\n\n\n<p>When the application will execute again the T-SQL, the Plan Guide will be used and the hint will boost the execution as expected:<\/p>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-6 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"397\" data-id=\"29499\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/11\/PlanGuide_5-2-1024x397.jpg\" alt=\"\" class=\"wp-image-29499\" srcset=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/11\/PlanGuide_5-2-1024x397.jpg 1024w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/11\/PlanGuide_5-2-300x116.jpg 300w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/11\/PlanGuide_5-2-768x298.jpg 768w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/11\/PlanGuide_5-2-1536x595.jpg 1536w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/11\/PlanGuide_5-2-2048x793.jpg 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/figure>\n\n\n\n<p>We can see that the script duration is much faster with around 5 second instead of 30 minutes and the plan uses the new Plan Guide with the hint we passed.<\/p>\n\n\n\n<p>Plan Guides are very powerful and can help to provide better performance for scripts where direct modifications are not an option. A second option would be to migrate to SQL Server 2022, we are also looking on this direction at my customer place but as it will take some times, Plan Guides will be used in the meantime \ud83d\ude09 <br><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Recently a customer asked me to check why a load process from a banking application has so poor performance.In fact this process is extremely slow, between 40 minutes up to more than one hour to load around 240&#8217;000 rows. As the application is a black box for my customer I have first to find out [&hellip;]<\/p>\n","protected":false},"author":21,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[229,198,368,99],"tags":[3179,3180,2124,3178,688,51],"type_dbi":[],"class_list":["post-29418","post","type-post","status-publish","format-standard","hentry","category-database-administration-monitoring","category-database-management","category-development-performance","category-sql-server","tag-boost-performance","tag-optimize-for-unknown","tag-plan","tag-plan-guides","tag-query-store","tag-sql-server"],"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>Boost dynamic SQL with Plan Guides - 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\/boost-dynamic-sql-with-plan-guide\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Boost dynamic SQL with Plan Guides\" \/>\n<meta property=\"og:description\" content=\"Recently a customer asked me to check why a load process from a banking application has so poor performance.In fact this process is extremely slow, between 40 minutes up to more than one hour to load around 240&#8217;000 rows. As the application is a black box for my customer I have first to find out [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.dbi-services.com\/blog\/boost-dynamic-sql-with-plan-guide\/\" \/>\n<meta property=\"og:site_name\" content=\"dbi Blog\" \/>\n<meta property=\"article:published_time\" content=\"2023-11-20T14:20:53+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-11-20T14:21:30+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/11\/PlanGuide_1-1024x441.jpg\" \/>\n<meta name=\"author\" content=\"St\u00e9phane Savorgnano\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"St\u00e9phane Savorgnano\" \/>\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\/boost-dynamic-sql-with-plan-guide\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/boost-dynamic-sql-with-plan-guide\/\"},\"author\":{\"name\":\"St\u00e9phane Savorgnano\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/b6bce7d75118b35bdb3b439ad6a9ca3c\"},\"headline\":\"Boost dynamic SQL with Plan Guides\",\"datePublished\":\"2023-11-20T14:20:53+00:00\",\"dateModified\":\"2023-11-20T14:21:30+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/boost-dynamic-sql-with-plan-guide\/\"},\"wordCount\":816,\"commentCount\":1,\"image\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/boost-dynamic-sql-with-plan-guide\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/11\/PlanGuide_1-1024x441.jpg\",\"keywords\":[\"Boost performance\",\"optimize for unknown\",\"plan\",\"Plan Guides\",\"query store\",\"SQL Server\"],\"articleSection\":[\"Database Administration &amp; Monitoring\",\"Database management\",\"Development &amp; Performance\",\"SQL Server\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/boost-dynamic-sql-with-plan-guide\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/boost-dynamic-sql-with-plan-guide\/\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/boost-dynamic-sql-with-plan-guide\/\",\"name\":\"Boost dynamic SQL with Plan Guides - dbi Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/boost-dynamic-sql-with-plan-guide\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/boost-dynamic-sql-with-plan-guide\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/11\/PlanGuide_1-1024x441.jpg\",\"datePublished\":\"2023-11-20T14:20:53+00:00\",\"dateModified\":\"2023-11-20T14:21:30+00:00\",\"author\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/b6bce7d75118b35bdb3b439ad6a9ca3c\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/boost-dynamic-sql-with-plan-guide\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/boost-dynamic-sql-with-plan-guide\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/boost-dynamic-sql-with-plan-guide\/#primaryimage\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/11\/PlanGuide_1.jpg\",\"contentUrl\":\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/11\/PlanGuide_1.jpg\",\"width\":2438,\"height\":1050},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/boost-dynamic-sql-with-plan-guide\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\/\/www.dbi-services.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Boost dynamic SQL with Plan Guides\"}]},{\"@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\/b6bce7d75118b35bdb3b439ad6a9ca3c\",\"name\":\"St\u00e9phane Savorgnano\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/88d2a790f775c52c1012ec644d883431da758f2cbcfc16067ade04d2ef625ef5?s=96&d=mm&r=g\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/88d2a790f775c52c1012ec644d883431da758f2cbcfc16067ade04d2ef625ef5?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/88d2a790f775c52c1012ec644d883431da758f2cbcfc16067ade04d2ef625ef5?s=96&d=mm&r=g\",\"caption\":\"St\u00e9phane Savorgnano\"},\"description\":\"St\u00e9phane Savorgnano has more than fifteen years of experience in Microsoft software development and in SQL Server database solutions. He is specialized in SQL Server installation, performance analysis, best practices, etc. St\u00e9phane Savorgnano is Microsoft Certified Solutions Associate (MCSA) and\u00a0Microsoft Certified Solutions Expert (MCSE) for SQL Server 2012. He is also Microsoft Certified Technology Specialist (MCTS) and Microsoft Certified IT Professional (MCITP) for SQL Server 2008 as well as ITIL Foundation V3 certified. Prior to joining dbi services, he was software engineer at Ciba Specialty Chemicals in Basel. St\u00e9phane Savorgnano holds a Master of Informatics from Mulhouse University (F). His branch-related experience covers Banking \/ Financial Services, Chemicals &amp; Pharmaceuticals, etc.\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/author\/stephane-savorgnano\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Boost dynamic SQL with Plan Guides - 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\/boost-dynamic-sql-with-plan-guide\/","og_locale":"en_US","og_type":"article","og_title":"Boost dynamic SQL with Plan Guides","og_description":"Recently a customer asked me to check why a load process from a banking application has so poor performance.In fact this process is extremely slow, between 40 minutes up to more than one hour to load around 240&#8217;000 rows. As the application is a black box for my customer I have first to find out [&hellip;]","og_url":"https:\/\/www.dbi-services.com\/blog\/boost-dynamic-sql-with-plan-guide\/","og_site_name":"dbi Blog","article_published_time":"2023-11-20T14:20:53+00:00","article_modified_time":"2023-11-20T14:21:30+00:00","og_image":[{"url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/11\/PlanGuide_1-1024x441.jpg","type":"","width":"","height":""}],"author":"St\u00e9phane Savorgnano","twitter_card":"summary_large_image","twitter_misc":{"Written by":"St\u00e9phane Savorgnano","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.dbi-services.com\/blog\/boost-dynamic-sql-with-plan-guide\/#article","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/boost-dynamic-sql-with-plan-guide\/"},"author":{"name":"St\u00e9phane Savorgnano","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/b6bce7d75118b35bdb3b439ad6a9ca3c"},"headline":"Boost dynamic SQL with Plan Guides","datePublished":"2023-11-20T14:20:53+00:00","dateModified":"2023-11-20T14:21:30+00:00","mainEntityOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/boost-dynamic-sql-with-plan-guide\/"},"wordCount":816,"commentCount":1,"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/boost-dynamic-sql-with-plan-guide\/#primaryimage"},"thumbnailUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/11\/PlanGuide_1-1024x441.jpg","keywords":["Boost performance","optimize for unknown","plan","Plan Guides","query store","SQL Server"],"articleSection":["Database Administration &amp; Monitoring","Database management","Development &amp; Performance","SQL Server"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.dbi-services.com\/blog\/boost-dynamic-sql-with-plan-guide\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.dbi-services.com\/blog\/boost-dynamic-sql-with-plan-guide\/","url":"https:\/\/www.dbi-services.com\/blog\/boost-dynamic-sql-with-plan-guide\/","name":"Boost dynamic SQL with Plan Guides - dbi Blog","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/boost-dynamic-sql-with-plan-guide\/#primaryimage"},"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/boost-dynamic-sql-with-plan-guide\/#primaryimage"},"thumbnailUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/11\/PlanGuide_1-1024x441.jpg","datePublished":"2023-11-20T14:20:53+00:00","dateModified":"2023-11-20T14:21:30+00:00","author":{"@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/b6bce7d75118b35bdb3b439ad6a9ca3c"},"breadcrumb":{"@id":"https:\/\/www.dbi-services.com\/blog\/boost-dynamic-sql-with-plan-guide\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.dbi-services.com\/blog\/boost-dynamic-sql-with-plan-guide\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.dbi-services.com\/blog\/boost-dynamic-sql-with-plan-guide\/#primaryimage","url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/11\/PlanGuide_1.jpg","contentUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/11\/PlanGuide_1.jpg","width":2438,"height":1050},{"@type":"BreadcrumbList","@id":"https:\/\/www.dbi-services.com\/blog\/boost-dynamic-sql-with-plan-guide\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/www.dbi-services.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Boost dynamic SQL with Plan Guides"}]},{"@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\/b6bce7d75118b35bdb3b439ad6a9ca3c","name":"St\u00e9phane Savorgnano","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/88d2a790f775c52c1012ec644d883431da758f2cbcfc16067ade04d2ef625ef5?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/88d2a790f775c52c1012ec644d883431da758f2cbcfc16067ade04d2ef625ef5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/88d2a790f775c52c1012ec644d883431da758f2cbcfc16067ade04d2ef625ef5?s=96&d=mm&r=g","caption":"St\u00e9phane Savorgnano"},"description":"St\u00e9phane Savorgnano has more than fifteen years of experience in Microsoft software development and in SQL Server database solutions. He is specialized in SQL Server installation, performance analysis, best practices, etc. St\u00e9phane Savorgnano is Microsoft Certified Solutions Associate (MCSA) and\u00a0Microsoft Certified Solutions Expert (MCSE) for SQL Server 2012. He is also Microsoft Certified Technology Specialist (MCTS) and Microsoft Certified IT Professional (MCITP) for SQL Server 2008 as well as ITIL Foundation V3 certified. Prior to joining dbi services, he was software engineer at Ciba Specialty Chemicals in Basel. St\u00e9phane Savorgnano holds a Master of Informatics from Mulhouse University (F). His branch-related experience covers Banking \/ Financial Services, Chemicals &amp; Pharmaceuticals, etc.","url":"https:\/\/www.dbi-services.com\/blog\/author\/stephane-savorgnano\/"}]}},"_links":{"self":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/29418","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\/21"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/comments?post=29418"}],"version-history":[{"count":26,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/29418\/revisions"}],"predecessor-version":[{"id":29512,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/29418\/revisions\/29512"}],"wp:attachment":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media?parent=29418"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/categories?post=29418"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/tags?post=29418"},{"taxonomy":"type","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/type_dbi?post=29418"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}