{"id":815,"date":"2006-12-30T06:23:00","date_gmt":"2006-12-30T06:23:00","guid":{"rendered":"\/blogs\/bobb\/post\/Some-questions-and-answers-on-plan-guides.aspx"},"modified":"2013-01-07T09:00:24","modified_gmt":"2013-01-07T17:00:24","slug":"some-questions-and-answers-on-plan-guides","status":"publish","type":"post","link":"https:\/\/www.sqlskills.com\/blogs\/bobb\/some-questions-and-answers-on-plan-guides\/","title":{"rendered":"Some questions and answers on plan guides"},"content":{"rendered":"<p>\nThought I&#39;d answer one last question or two from the last time I did the talk on SQL Server&nbsp;2005&nbsp;plan guides.&nbsp;If you&#39;re asking at this point &quot;what is a plan guide&quot;, reference the SQL Server 2005 BOL or <a href=\"http:\/\/3.209.169.194\/blogs\/bobb\/query-plan-guides-in-the-sql-server-2005-bol\/\" class=\"broken_link\">this<\/a> blog entry.\n<\/p>\n<p>\nQ. Can you use a plan guide on an encrypted procedure? I want to put a hint on encrypted vendor-supplied code.<br \/>\nA. No, per books online you cannot create an OBJECT plan guide on any object that is itself encrypted or references an encrypted object. You get error message 10512 if you try.\n<\/p>\n<p>\nQ. Can you create a plan guide on the SQL statement (rather than an OBJECT plan guide) on a SQL statement that I know exists as part of an encrypted procedure and have the guide be used?<br \/>\nA. You can create a SQL-type plan guide on a statement in a procedure, but it won&#39;t be used in any case; you need to create an OBJECT-type plan guide for it to be usable inside a procedure. You can confirm its &quot;non-use&quot; by looking at the showplan output from an un-encrypted procedure with a SQL-type plan guide; you can&#39;t see an XML showplan&nbsp;for statements in&nbsp;an encrypted procedure.\n<\/p>\n<p>\nQ. Can I have more than one plan guide? For example to ENABLE\/DISABLE different guides at different times of the day? Can I have two guides enabled at the same time?<br \/>\nA. You can&#39;t create more than one plan guide on a single statement\/module-or-object combination, whether they are DISABLEd or not. You get error message 10502 if you try. You&#39;d have to DROP the first plan guide before you can create the second one.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Thought I&#39;d answer one last question or two from the last time I did the talk on SQL Server&nbsp;2005&nbsp;plan guides.&nbsp;If you&#39;re asking at this point &quot;what is a plan guide&quot;, reference the SQL Server 2005 BOL or this blog entry. Q. Can you use a plan guide on an encrypted procedure? I want to put [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19,28],"tags":[],"class_list":["post-815","post","type-post","status-publish","format-standard","hentry","category-performance","category-sql-server-2005"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.9.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Some questions and answers on plan guides - Bob Beauchemin<\/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.sqlskills.com\/blogs\/bobb\/some-questions-and-answers-on-plan-guides\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Some questions and answers on plan guides - Bob Beauchemin\" \/>\n<meta property=\"og:description\" content=\"Thought I&#039;d answer one last question or two from the last time I did the talk on SQL Server&nbsp;2005&nbsp;plan guides.&nbsp;If you&#039;re asking at this point &quot;what is a plan guide&quot;, reference the SQL Server 2005 BOL or this blog entry. Q. Can you use a plan guide on an encrypted procedure? I want to put [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.sqlskills.com\/blogs\/bobb\/some-questions-and-answers-on-plan-guides\/\" \/>\n<meta property=\"og:site_name\" content=\"Bob Beauchemin\" \/>\n<meta property=\"article:published_time\" content=\"2006-12-30T06:23:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2013-01-07T17:00:24+00:00\" \/>\n<meta name=\"author\" content=\"Bob Beauchemin\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Bob Beauchemin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/some-questions-and-answers-on-plan-guides\/\",\"url\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/some-questions-and-answers-on-plan-guides\/\",\"name\":\"Some questions and answers on plan guides - Bob Beauchemin\",\"isPartOf\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/#website\"},\"datePublished\":\"2006-12-30T06:23:00+00:00\",\"dateModified\":\"2013-01-07T17:00:24+00:00\",\"author\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/#\/schema\/person\/62bfa986c5b5d28fcffd8b4fc409c73e\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/some-questions-and-answers-on-plan-guides\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.sqlskills.com\/blogs\/bobb\/some-questions-and-answers-on-plan-guides\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/some-questions-and-answers-on-plan-guides\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Performance\",\"item\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/category\/performance\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Some questions and answers on plan guides\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/#website\",\"url\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/\",\"name\":\"Bob Beauchemin\",\"description\":\"SQL Server Blog\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/#\/schema\/person\/62bfa986c5b5d28fcffd8b4fc409c73e\",\"name\":\"Bob Beauchemin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/6f80e6cc667410857fa6a21931dc528b8092f4d112bf7a8ff7c267674d44ee37?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/6f80e6cc667410857fa6a21931dc528b8092f4d112bf7a8ff7c267674d44ee37?s=96&d=mm&r=g\",\"caption\":\"Bob Beauchemin\"},\"sameAs\":[\"http:\/www.sqlskills.com\/blogs\/bobb\/\"],\"url\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/author\/bobb\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Some questions and answers on plan guides - Bob Beauchemin","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\/bobb\/some-questions-and-answers-on-plan-guides\/","og_locale":"en_US","og_type":"article","og_title":"Some questions and answers on plan guides - Bob Beauchemin","og_description":"Thought I&#39;d answer one last question or two from the last time I did the talk on SQL Server&nbsp;2005&nbsp;plan guides.&nbsp;If you&#39;re asking at this point &quot;what is a plan guide&quot;, reference the SQL Server 2005 BOL or this blog entry. Q. Can you use a plan guide on an encrypted procedure? I want to put [&hellip;]","og_url":"https:\/\/www.sqlskills.com\/blogs\/bobb\/some-questions-and-answers-on-plan-guides\/","og_site_name":"Bob Beauchemin","article_published_time":"2006-12-30T06:23:00+00:00","article_modified_time":"2013-01-07T17:00:24+00:00","author":"Bob Beauchemin","twitter_misc":{"Written by":"Bob Beauchemin","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/some-questions-and-answers-on-plan-guides\/","url":"https:\/\/www.sqlskills.com\/blogs\/bobb\/some-questions-and-answers-on-plan-guides\/","name":"Some questions and answers on plan guides - Bob Beauchemin","isPartOf":{"@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/#website"},"datePublished":"2006-12-30T06:23:00+00:00","dateModified":"2013-01-07T17:00:24+00:00","author":{"@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/#\/schema\/person\/62bfa986c5b5d28fcffd8b4fc409c73e"},"breadcrumb":{"@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/some-questions-and-answers-on-plan-guides\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.sqlskills.com\/blogs\/bobb\/some-questions-and-answers-on-plan-guides\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/some-questions-and-answers-on-plan-guides\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.sqlskills.com\/blogs\/bobb\/"},{"@type":"ListItem","position":2,"name":"Performance","item":"https:\/\/www.sqlskills.com\/blogs\/bobb\/category\/performance\/"},{"@type":"ListItem","position":3,"name":"Some questions and answers on plan guides"}]},{"@type":"WebSite","@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/#website","url":"https:\/\/www.sqlskills.com\/blogs\/bobb\/","name":"Bob Beauchemin","description":"SQL Server Blog","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.sqlskills.com\/blogs\/bobb\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/#\/schema\/person\/62bfa986c5b5d28fcffd8b4fc409c73e","name":"Bob Beauchemin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/6f80e6cc667410857fa6a21931dc528b8092f4d112bf7a8ff7c267674d44ee37?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/6f80e6cc667410857fa6a21931dc528b8092f4d112bf7a8ff7c267674d44ee37?s=96&d=mm&r=g","caption":"Bob Beauchemin"},"sameAs":["http:\/www.sqlskills.com\/blogs\/bobb\/"],"url":"https:\/\/www.sqlskills.com\/blogs\/bobb\/author\/bobb\/"}]}},"_links":{"self":[{"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/posts\/815","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/comments?post=815"}],"version-history":[{"count":0,"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/posts\/815\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/media?parent=815"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/categories?post=815"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/tags?post=815"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}