{"id":12105,"date":"2019-05-09T21:20:24","date_gmt":"2019-05-09T21:20:24","guid":{"rendered":"https:\/\/dbtut.com\/?p=12105"},"modified":"2019-05-10T01:00:02","modified_gmt":"2019-05-10T01:00:02","slug":"increase-query-performance-in-sql-server-using-sp_create_plan_guide-system-stored-procedure","status":"publish","type":"post","link":"https:\/\/dbtut.com\/index.php\/2019\/05\/09\/increase-query-performance-in-sql-server-using-sp_create_plan_guide-system-stored-procedure\/","title":{"rendered":"Increase Query Performance in SQL Server Using sp_create_plan_guide System Stored Procedure"},"content":{"rendered":"<p>sp_create_plan_guide introduced with sql server 2005. With this sp, you can increase the performance of your queries that you can&#8217;t intervene or change, by adding a plan guide. (we&#8217;re adding query hints to the relevant sp or tsql in the plan guide).<\/p>\n<p>After you create the plan guide and run sp or sql in the normal way, it will now work as you specified in the plan guide.<\/p>\n<p>You can use the following script to see if there is a plan guide in the database.<\/p>\n<pre class=\"lang:default decode:true\">SELECT * FROM sys.plan_guides\n<\/pre>\n<p>If you want to delete an existing plan guide, you can delete it from the programmability at the bottom of the database and then from the Plan Guides tab.<\/p>\n<p>You can also use the following script to delete a specific plan guide.<\/p>\n<pre class=\"lang:default decode:true\">EXEC sp_control_plan_guide N'DROP', N'Guide3';\n<\/pre>\n<h2>Plan Guide Types<\/h2>\n<p>There are 3 types of plan quide.<\/p>\n<ol type=\"1\">\n<li value=\"1\">Object Plan Guides<\/li>\n<li>SQL Plan Guides<\/li>\n<li>Template Plan Guides<\/li>\n<\/ol>\n<h3>Object Plan Guides<\/h3>\n<p>A type of plan guide applied to an object in the database. For example, there is parameter sniffing problem about a stored procedure, and you can not add the OPTIMIZE FOR query hint to the end of the query for certain reasons.<\/p>\n<p>I recommend you read the article &#8220;<a href=\"https:\/\/dbtut.com\/index.php\/2018\/07\/20\/what-is-paramater-sniffing\/\" target=\"_blank\" rel=\"noopener noreferrer\">What is Parameter Sniffing<\/a>&#8221; to understand parameter sniffing before starting the examples.<\/p>\n<p>You can create a plan guide to the stored procedure as follows.<\/p>\n<h4>Example Stored Procedure<\/h4>\n<pre class=\"lang:default decode:true \">CREATE PROCEDURE Sales.GetSalesOrderByCountry (@Country nvarchar(60))\nAS\nBEGIN\n    SELECT *\n    FROM Sales.SalesOrderHeader h, Sales.Customer c, \n        Sales.SalesTerritory t\n    WHERE h.CustomerID = c.CustomerID\n        AND c.TerritoryID = t.TerritoryID\n        AND CountryRegionCode = @Country\nEND\n<\/pre>\n<p>As you can see, the stored procedure has a Country parameter as a parameter. Consider that 90% of the values \u200b\u200bin the Country column in the table are &#8220;Turkey&#8221;, and 10% is &#8220;United States&#8221;. When the query first executes, it generates a query plan. Suppose the Query Plan is generated for the &#8220;United States&#8221; value. When the query is then executed for the &#8220;Turkey&#8221; value, the parameter sniffing will occur.<\/p>\n<p>Therefore, by creating a plan guide and adding a query hint to sp, we can generate the query plan for &#8220;Turkey&#8221; value. This will result in faster results.<\/p>\n<pre class=\"lang:default decode:true\">sp_create_plan_guide \n@name = N'Guide1',\n@stmt = N'SELECT * FROM Sales.SalesOrderHeader h,\n        Sales.Customer c,\n        Sales.SalesTerritory t\n        WHERE h.CustomerID = c.CustomerID \n            AND c.TerritoryID = t.TerritoryID\n            AND CountryRegionCode = @Country',\n@type = N'OBJECT',\n@module_or_batch = N'Sales.GetSalesOrderByCountry',\n@params = NULL,\n@hints = N'OPTION (OPTIMIZE FOR (@Country = N''Turkey''))'\n<\/pre>\n<h3>SQL Plan Guides<\/h3>\n<p>As the name implies, it is a kind of plan guide that is created for an sql statement rather than an object.<\/p>\n<p>Imagine that you have a query as follows.<\/p>\n<pre class=\"lang:default decode:true \">SELECT TOP 1 * FROM Sales.SalesOrderHeader h ORDER BY OrderDate DESC\n<\/pre>\n<p>Let us assume that the maxdop setting on the instance on which the query is running is set to 8, and this query runs slowly due to the maxdop setting in instance. By adding OPTION (MAXDOP 1) query hint to the end of the query, we can have the query run with a single cpu.<\/p>\n<p>To learn what MAXDOP is, you may want to read the article &#8220;<a href=\"https:\/\/dbtut.com\/index.php\/2018\/10\/25\/numa-nodes-max-min-server-memory-log-pages-in-memory-and-maxdop\/\" target=\"_blank\" rel=\"noopener noreferrer\">Numa Nodes, MAX \/ MIN Server Memory, Lock Pages In Memory, MAXDOP<\/a>&#8220;.<\/p>\n<p>In the example below, you can see how to add maxdop query hint to the end of the query using the sql plan guide.<\/p>\n<pre class=\"lang:default decode:true\">sp_create_plan_guide \n@name = N'Guide1', \n@stmt = N'SELECT TOP 1 * FROM Sales.SalesOrderHeader h ORDER BY OrderDate DESC',\u00a0 \n@type = N'SQL',\n@module_or_batch = NULL, \n@params = NULL, \n@hints = N'OPTION (MAXDOP 1)'\n<\/pre>\n<h3>Template Plan Guides<\/h3>\n<p>The behavior of some queries changes when we set parameterization in the database. With the Template plan guide, we can change the parameterization setting for specific queries.<\/p>\n<p>For parameterization, you may want to read &#8220;<a href=\"https:\/\/dbtut.com\/index.php\/2019\/05\/10\/optimize-for-ad-hoc-workloads-and-parameterization-in-sql-server\/\" target=\"_blank\" rel=\"noopener noreferrer\">Optimize for ad hoc workloads and Parameterization in SQL Server<\/a>&#8220;.<\/p>\n<p>For example, if the parameterization setting in the database is set to FORCE and you want a query to run as simple parameterization, this plan guide will be useful.<\/p>\n<p>In the following example, you can see how this is done.<\/p>\n<pre class=\"lang:default decode:true \">DECLARE @stmt nvarchar(max);\nDECLARE @params nvarchar(max);\nEXEC sp_get_query_template \n    N'SELECT pi.ProductID, SUM(pi.Quantity) AS Total \n      FROM Production.ProductModel AS pm \n      INNER JOIN Production.ProductInventory AS pi ON pm.ProductModelID = pi.ProductID \n      WHERE pi.ProductID = 101 \n      GROUP BY pi.ProductID, pi.Quantity \n      HAVING sum(pi.Quantity) &gt; 50',\n    @stmt OUTPUT, \n    @params OUTPUT;\nEXEC sp_create_plan_guide \n    N'TemplateGuide1', \n    @stmt, \n    N'TEMPLATE', \n    NULL, \n    @params, \n    N'OPTION(PARAMETERIZATION FORCED)';\n<\/pre>\n\n<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_12105\" class=\"pvc_stats all  \" data-element-id=\"12105\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/dbtut.com\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"excerpt":{"rendered":"<p>sp_create_plan_guide introduced with sql server 2005. With this sp, you can increase the performance of your queries that you can&#8217;t intervene or change, by adding a plan guide. (we&#8217;re adding query hints to the relevant sp or tsql in the plan guide). After you create the plan guide and run sp or sql in the &hellip;<\/p>\n<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_12105\" class=\"pvc_stats all  \" data-element-id=\"12105\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/dbtut.com\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"author":1,"featured_media":12111,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[3],"tags":[4005,3999,4006,4007,3997,3991,3992,3989,3987,4003,3994,3993,4001,4000,3990,4004,4002,3988,3996,3995,3998],"class_list":["post-12105","post","type-post","status-publish","format-standard","has-post-thumbnail","","category-mssql","tag-create-plan-guide-for-stored-procedure","tag-creating-a-plan-guide","tag-execution-plan-in-sql-server-2016","tag-how-to-check-plan-guides-in-sql-server","tag-how-to-use-a-sql-server-plan-guide-to-tune-queries","tag-object-plan-guide","tag-object-plan-guides","tag-plan-guide-types","tag-sp_create_plan_guide","tag-sp_create_plan_guide_from_handle","tag-sql-plan-guide","tag-sql-plan-guides","tag-sql-server-check-if-plan-guide-is-used","tag-sql-server-plan-guide-index-hint","tag-sql-server-plan-guide-types","tag-sql-server-plan-stability","tag-sql-server-use-plan","tag-sys-plan_guides","tag-template-plan-guide","tag-template-plan-guides","tag-using-sql-server-plan-guides"],"aioseo_notices":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Increase Query Performance in SQL Server Using sp_create_plan_guide System Stored Procedure - Database Tutorials<\/title>\n<meta name=\"description\" content=\"Increase Query Performance in SQL Server Using sp_create_plan_guide System Stored Procedure\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/dbtut.com\/index.php\/2019\/05\/09\/increase-query-performance-in-sql-server-using-sp_create_plan_guide-system-stored-procedure\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Increase Query Performance in SQL Server Using sp_create_plan_guide System Stored Procedure - Database Tutorials\" \/>\n<meta property=\"og:description\" content=\"Increase Query Performance in SQL Server Using sp_create_plan_guide System Stored Procedure\" \/>\n<meta property=\"og:url\" content=\"https:\/\/dbtut.com\/index.php\/2019\/05\/09\/increase-query-performance-in-sql-server-using-sp_create_plan_guide-system-stored-procedure\/\" \/>\n<meta property=\"og:site_name\" content=\"Database Tutorials\" \/>\n<meta property=\"article:published_time\" content=\"2019-05-09T21:20:24+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-05-10T01:00:02+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/dbtut.com\/wp-content\/uploads\/2019\/05\/Ads\u0131z-18.png\" \/>\n\t<meta property=\"og:image:width\" content=\"619\" \/>\n\t<meta property=\"og:image:height\" content=\"406\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"dbtut\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"dbtut\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/dbtut.com\/index.php\/2019\/05\/09\/increase-query-performance-in-sql-server-using-sp_create_plan_guide-system-stored-procedure\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/dbtut.com\/index.php\/2019\/05\/09\/increase-query-performance-in-sql-server-using-sp_create_plan_guide-system-stored-procedure\/\"},\"author\":{\"name\":\"dbtut\",\"@id\":\"https:\/\/dbtut.com\/#\/schema\/person\/fc047c39e1e53dce28fc4253529ea408\"},\"headline\":\"Increase Query Performance in SQL Server Using sp_create_plan_guide System Stored Procedure\",\"datePublished\":\"2019-05-09T21:20:24+00:00\",\"dateModified\":\"2019-05-10T01:00:02+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/dbtut.com\/index.php\/2019\/05\/09\/increase-query-performance-in-sql-server-using-sp_create_plan_guide-system-stored-procedure\/\"},\"wordCount\":558,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/dbtut.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/dbtut.com\/index.php\/2019\/05\/09\/increase-query-performance-in-sql-server-using-sp_create_plan_guide-system-stored-procedure\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/dbtut.com\/wp-content\/uploads\/2019\/05\/Ads\u0131z-18.png\",\"keywords\":[\"create plan guide for stored procedure\",\"creating a plan guide\",\"execution plan in sql server 2016\",\"how to check plan guides in sql server\",\"How to use a SQL Server Plan Guide to Tune Queries\",\"Object Plan Guide\",\"Object Plan Guides\",\"Plan Guide Types\",\"sp_create_plan_guide\",\"sp_create_plan_guide_from_handle\",\"SQL Plan Guide\",\"SQL Plan Guides\",\"sql server check if plan guide is used\",\"sql server plan guide index hint\",\"sql server Plan Guide Types\",\"sql server plan stability\",\"sql server use plan\",\"sys.plan_guides\",\"Template Plan Guide\",\"Template Plan Guides\",\"Using SQL Server Plan Guides\"],\"articleSection\":[\"MSSQL\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/dbtut.com\/index.php\/2019\/05\/09\/increase-query-performance-in-sql-server-using-sp_create_plan_guide-system-stored-procedure\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/dbtut.com\/index.php\/2019\/05\/09\/increase-query-performance-in-sql-server-using-sp_create_plan_guide-system-stored-procedure\/\",\"url\":\"https:\/\/dbtut.com\/index.php\/2019\/05\/09\/increase-query-performance-in-sql-server-using-sp_create_plan_guide-system-stored-procedure\/\",\"name\":\"Increase Query Performance in SQL Server Using sp_create_plan_guide System Stored Procedure - Database Tutorials\",\"isPartOf\":{\"@id\":\"https:\/\/dbtut.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/dbtut.com\/index.php\/2019\/05\/09\/increase-query-performance-in-sql-server-using-sp_create_plan_guide-system-stored-procedure\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/dbtut.com\/index.php\/2019\/05\/09\/increase-query-performance-in-sql-server-using-sp_create_plan_guide-system-stored-procedure\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/dbtut.com\/wp-content\/uploads\/2019\/05\/Ads\u0131z-18.png\",\"datePublished\":\"2019-05-09T21:20:24+00:00\",\"dateModified\":\"2019-05-10T01:00:02+00:00\",\"description\":\"Increase Query Performance in SQL Server Using sp_create_plan_guide System Stored Procedure\",\"breadcrumb\":{\"@id\":\"https:\/\/dbtut.com\/index.php\/2019\/05\/09\/increase-query-performance-in-sql-server-using-sp_create_plan_guide-system-stored-procedure\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/dbtut.com\/index.php\/2019\/05\/09\/increase-query-performance-in-sql-server-using-sp_create_plan_guide-system-stored-procedure\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/dbtut.com\/index.php\/2019\/05\/09\/increase-query-performance-in-sql-server-using-sp_create_plan_guide-system-stored-procedure\/#primaryimage\",\"url\":\"https:\/\/dbtut.com\/wp-content\/uploads\/2019\/05\/Ads\u0131z-18.png\",\"contentUrl\":\"https:\/\/dbtut.com\/wp-content\/uploads\/2019\/05\/Ads\u0131z-18.png\",\"width\":619,\"height\":406},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/dbtut.com\/index.php\/2019\/05\/09\/increase-query-performance-in-sql-server-using-sp_create_plan_guide-system-stored-procedure\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/dbtut.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Increase Query Performance in SQL Server Using sp_create_plan_guide System Stored Procedure\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/dbtut.com\/#website\",\"url\":\"https:\/\/dbtut.com\/\",\"name\":\"Database Tutorials\",\"description\":\"MSSQL, Oracle, PostgreSQL, MySQL, MariaDB, DB2, Sybase, Teradata, Big Data, NOSQL, MongoDB, Couchbase, Cassandra, Windows, Linux\",\"publisher\":{\"@id\":\"https:\/\/dbtut.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/dbtut.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/dbtut.com\/#organization\",\"name\":\"dbtut\",\"url\":\"https:\/\/dbtut.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/dbtut.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/dbtut.com\/wp-content\/uploads\/2021\/02\/dbtutlogo.jpg\",\"contentUrl\":\"https:\/\/dbtut.com\/wp-content\/uploads\/2021\/02\/dbtutlogo.jpg\",\"width\":223,\"height\":36,\"caption\":\"dbtut\"},\"image\":{\"@id\":\"https:\/\/dbtut.com\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/dbtut.com\/#\/schema\/person\/fc047c39e1e53dce28fc4253529ea408\",\"name\":\"dbtut\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/dbtut.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/c322c32021bf651d9e103b183963c479a9c9791ead0715f4348203496c39aa54?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/c322c32021bf651d9e103b183963c479a9c9791ead0715f4348203496c39aa54?s=96&d=mm&r=g\",\"caption\":\"dbtut\"},\"description\":\"We are a team with over 10 years of database management and BI experience. Our Expertises: Oracle, SQL Server, PostgreSQL, MySQL, MongoDB, Elasticsearch, Kibana, Grafana.\",\"sameAs\":[\"http:\/\/NurullahCAKIR\"],\"url\":\"https:\/\/dbtut.com\/index.php\/author\/dbtut\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Increase Query Performance in SQL Server Using sp_create_plan_guide System Stored Procedure - Database Tutorials","description":"Increase Query Performance in SQL Server Using sp_create_plan_guide System Stored Procedure","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:\/\/dbtut.com\/index.php\/2019\/05\/09\/increase-query-performance-in-sql-server-using-sp_create_plan_guide-system-stored-procedure\/","og_locale":"en_US","og_type":"article","og_title":"Increase Query Performance in SQL Server Using sp_create_plan_guide System Stored Procedure - Database Tutorials","og_description":"Increase Query Performance in SQL Server Using sp_create_plan_guide System Stored Procedure","og_url":"https:\/\/dbtut.com\/index.php\/2019\/05\/09\/increase-query-performance-in-sql-server-using-sp_create_plan_guide-system-stored-procedure\/","og_site_name":"Database Tutorials","article_published_time":"2019-05-09T21:20:24+00:00","article_modified_time":"2019-05-10T01:00:02+00:00","og_image":[{"width":619,"height":406,"url":"https:\/\/dbtut.com\/wp-content\/uploads\/2019\/05\/Ads\u0131z-18.png","type":"image\/png"}],"author":"dbtut","twitter_card":"summary_large_image","twitter_misc":{"Written by":"dbtut","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/dbtut.com\/index.php\/2019\/05\/09\/increase-query-performance-in-sql-server-using-sp_create_plan_guide-system-stored-procedure\/#article","isPartOf":{"@id":"https:\/\/dbtut.com\/index.php\/2019\/05\/09\/increase-query-performance-in-sql-server-using-sp_create_plan_guide-system-stored-procedure\/"},"author":{"name":"dbtut","@id":"https:\/\/dbtut.com\/#\/schema\/person\/fc047c39e1e53dce28fc4253529ea408"},"headline":"Increase Query Performance in SQL Server Using sp_create_plan_guide System Stored Procedure","datePublished":"2019-05-09T21:20:24+00:00","dateModified":"2019-05-10T01:00:02+00:00","mainEntityOfPage":{"@id":"https:\/\/dbtut.com\/index.php\/2019\/05\/09\/increase-query-performance-in-sql-server-using-sp_create_plan_guide-system-stored-procedure\/"},"wordCount":558,"commentCount":0,"publisher":{"@id":"https:\/\/dbtut.com\/#organization"},"image":{"@id":"https:\/\/dbtut.com\/index.php\/2019\/05\/09\/increase-query-performance-in-sql-server-using-sp_create_plan_guide-system-stored-procedure\/#primaryimage"},"thumbnailUrl":"https:\/\/dbtut.com\/wp-content\/uploads\/2019\/05\/Ads\u0131z-18.png","keywords":["create plan guide for stored procedure","creating a plan guide","execution plan in sql server 2016","how to check plan guides in sql server","How to use a SQL Server Plan Guide to Tune Queries","Object Plan Guide","Object Plan Guides","Plan Guide Types","sp_create_plan_guide","sp_create_plan_guide_from_handle","SQL Plan Guide","SQL Plan Guides","sql server check if plan guide is used","sql server plan guide index hint","sql server Plan Guide Types","sql server plan stability","sql server use plan","sys.plan_guides","Template Plan Guide","Template Plan Guides","Using SQL Server Plan Guides"],"articleSection":["MSSQL"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/dbtut.com\/index.php\/2019\/05\/09\/increase-query-performance-in-sql-server-using-sp_create_plan_guide-system-stored-procedure\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/dbtut.com\/index.php\/2019\/05\/09\/increase-query-performance-in-sql-server-using-sp_create_plan_guide-system-stored-procedure\/","url":"https:\/\/dbtut.com\/index.php\/2019\/05\/09\/increase-query-performance-in-sql-server-using-sp_create_plan_guide-system-stored-procedure\/","name":"Increase Query Performance in SQL Server Using sp_create_plan_guide System Stored Procedure - Database Tutorials","isPartOf":{"@id":"https:\/\/dbtut.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/dbtut.com\/index.php\/2019\/05\/09\/increase-query-performance-in-sql-server-using-sp_create_plan_guide-system-stored-procedure\/#primaryimage"},"image":{"@id":"https:\/\/dbtut.com\/index.php\/2019\/05\/09\/increase-query-performance-in-sql-server-using-sp_create_plan_guide-system-stored-procedure\/#primaryimage"},"thumbnailUrl":"https:\/\/dbtut.com\/wp-content\/uploads\/2019\/05\/Ads\u0131z-18.png","datePublished":"2019-05-09T21:20:24+00:00","dateModified":"2019-05-10T01:00:02+00:00","description":"Increase Query Performance in SQL Server Using sp_create_plan_guide System Stored Procedure","breadcrumb":{"@id":"https:\/\/dbtut.com\/index.php\/2019\/05\/09\/increase-query-performance-in-sql-server-using-sp_create_plan_guide-system-stored-procedure\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/dbtut.com\/index.php\/2019\/05\/09\/increase-query-performance-in-sql-server-using-sp_create_plan_guide-system-stored-procedure\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/dbtut.com\/index.php\/2019\/05\/09\/increase-query-performance-in-sql-server-using-sp_create_plan_guide-system-stored-procedure\/#primaryimage","url":"https:\/\/dbtut.com\/wp-content\/uploads\/2019\/05\/Ads\u0131z-18.png","contentUrl":"https:\/\/dbtut.com\/wp-content\/uploads\/2019\/05\/Ads\u0131z-18.png","width":619,"height":406},{"@type":"BreadcrumbList","@id":"https:\/\/dbtut.com\/index.php\/2019\/05\/09\/increase-query-performance-in-sql-server-using-sp_create_plan_guide-system-stored-procedure\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/dbtut.com\/"},{"@type":"ListItem","position":2,"name":"Increase Query Performance in SQL Server Using sp_create_plan_guide System Stored Procedure"}]},{"@type":"WebSite","@id":"https:\/\/dbtut.com\/#website","url":"https:\/\/dbtut.com\/","name":"Database Tutorials","description":"MSSQL, Oracle, PostgreSQL, MySQL, MariaDB, DB2, Sybase, Teradata, Big Data, NOSQL, MongoDB, Couchbase, Cassandra, Windows, Linux","publisher":{"@id":"https:\/\/dbtut.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/dbtut.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/dbtut.com\/#organization","name":"dbtut","url":"https:\/\/dbtut.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/dbtut.com\/#\/schema\/logo\/image\/","url":"https:\/\/dbtut.com\/wp-content\/uploads\/2021\/02\/dbtutlogo.jpg","contentUrl":"https:\/\/dbtut.com\/wp-content\/uploads\/2021\/02\/dbtutlogo.jpg","width":223,"height":36,"caption":"dbtut"},"image":{"@id":"https:\/\/dbtut.com\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/dbtut.com\/#\/schema\/person\/fc047c39e1e53dce28fc4253529ea408","name":"dbtut","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/dbtut.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/c322c32021bf651d9e103b183963c479a9c9791ead0715f4348203496c39aa54?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c322c32021bf651d9e103b183963c479a9c9791ead0715f4348203496c39aa54?s=96&d=mm&r=g","caption":"dbtut"},"description":"We are a team with over 10 years of database management and BI experience. Our Expertises: Oracle, SQL Server, PostgreSQL, MySQL, MongoDB, Elasticsearch, Kibana, Grafana.","sameAs":["http:\/\/NurullahCAKIR"],"url":"https:\/\/dbtut.com\/index.php\/author\/dbtut\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/dbtut.com\/index.php\/wp-json\/wp\/v2\/posts\/12105","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dbtut.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dbtut.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dbtut.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dbtut.com\/index.php\/wp-json\/wp\/v2\/comments?post=12105"}],"version-history":[{"count":0,"href":"https:\/\/dbtut.com\/index.php\/wp-json\/wp\/v2\/posts\/12105\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dbtut.com\/index.php\/wp-json\/wp\/v2\/media\/12111"}],"wp:attachment":[{"href":"https:\/\/dbtut.com\/index.php\/wp-json\/wp\/v2\/media?parent=12105"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dbtut.com\/index.php\/wp-json\/wp\/v2\/categories?post=12105"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dbtut.com\/index.php\/wp-json\/wp\/v2\/tags?post=12105"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}