{"id":1744,"date":"2013-04-03T21:24:21","date_gmt":"2013-04-04T01:24:21","guid":{"rendered":"http:\/\/3.209.169.194\/blogs\/jonathan\/?p=1744"},"modified":"2017-04-13T12:55:38","modified_gmt":"2017-04-13T16:55:38","slug":"finding-key-lookups-inside-the-plan-cache","status":"publish","type":"post","link":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/finding-key-lookups-inside-the-plan-cache\/","title":{"rendered":"Finding Key Lookups inside the Plan Cache"},"content":{"rendered":"<p>This is actually a blog post I thought I&#8217;d written more than two years ago, but this morning when I went looking for it after receiving a question by email\u00a0 I realized that I&#8217;ve never blogged about this before.\u00a0 At PASS Summit 2010 I presented a session on performance tuning SQL Server by digging into the plan cache, and since then I have blogged a number of other plan cache parsing scripts.\u00a0 One of the demo scripts I showed at PASS was a query to find plans and statements in the plan cache that perform a Key Lookup operation.\u00a0 An example statement that performs a Key Lookup is shown below.<\/p>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">\r\nUSE &#x5B;AdventureWorks];\r\nGO\r\n\r\nSELECT NationalIDNumber, HireDate, MaritalStatus\r\nFROM HumanResources.Employee\r\nWHERE NationalIDNumber = N'14417807';\r\nGO\r\n<\/pre>\n<p><a href=\"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-content\/uploads\/2013\/04\/image.png\"><img fetchpriority=\"high\" decoding=\"async\" style=\"background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;\" title=\"image\" alt=\"image\" src=\"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-content\/uploads\/2013\/04\/image_thumb.png\" width=\"535\" height=\"214\" border=\"0\" \/><\/a><\/p>\n<p>Taking a look at the execution plan XML we can see that there isn&#8217;t an actual Key Lookup operator, instead the Index Scan operator associated with the Clustered Index Seek will have a Lookup attribute that is set to a value of 1, as shown in the XML\u00a0snip-it\u00a0below:<\/p>\n<pre class=\"brush: xml; highlight: [6]; title: ; notranslate\" title=\"\">\r\n&lt;RelOp NodeId=&quot;3&quot; PhysicalOp=&quot;Clustered Index Seek&quot; LogicalOp=&quot;Clustered Index Seek&quot; EstimateRows=&quot;1&quot; EstimateIO=&quot;0.003125&quot; EstimateCPU=&quot;0.0001581&quot; AvgRowSize=&quot;17&quot; EstimatedTotalSubtreeCost=&quot;0.0032831&quot; TableCardinality=&quot;290&quot; Parallel=&quot;0&quot; EstimateRebinds=&quot;0&quot; EstimateRewinds=&quot;0&quot; EstimatedExecutionMode=&quot;Row&quot;&gt;\r\n  &lt;OutputList&gt;\r\n    &lt;ColumnReference Database=&quot;&#x5B;AdventureWorks]&quot; Schema=&quot;&#x5B;HumanResources]&quot; Table=&quot;&#x5B;Employee]&quot; Column=&quot;MaritalStatus&quot; \/&gt;\r\n    &lt;ColumnReference Database=&quot;&#x5B;AdventureWorks]&quot; Schema=&quot;&#x5B;HumanResources]&quot; Table=&quot;&#x5B;Employee]&quot; Column=&quot;HireDate&quot; \/&gt;\r\n  &lt;\/OutputList&gt;\r\n  &lt;IndexScan Lookup=&quot;1&quot; Ordered=&quot;1&quot; ScanDirection=&quot;FORWARD&quot; ForcedIndex=&quot;0&quot; ForceSeek=&quot;0&quot; ForceScan=&quot;0&quot; NoExpandHint=&quot;0&quot; Storage=&quot;RowStore&quot;&gt;\r\n    &lt;DefinedValues&gt;\r\n      &lt;DefinedValue&gt;\r\n        &lt;ColumnReference Database=&quot;&#x5B;AdventureWorks]&quot; Schema=&quot;&#x5B;HumanResources]&quot; Table=&quot;&#x5B;Employee]&quot; Column=&quot;MaritalStatus&quot; \/&gt;\r\n      &lt;\/DefinedValue&gt;\r\n      &lt;DefinedValue&gt;\r\n        &lt;ColumnReference Database=&quot;&#x5B;AdventureWorks]&quot; Schema=&quot;&#x5B;HumanResources]&quot; Table=&quot;&#x5B;Employee]&quot; Column=&quot;HireDate&quot; \/&gt;\r\n      &lt;\/DefinedValue&gt;\r\n    &lt;\/DefinedValues&gt;\r\n    &lt;Object Database=&quot;&#x5B;AdventureWorks]&quot; Schema=&quot;&#x5B;HumanResources]&quot; Table=&quot;&#x5B;Employee]&quot; Index=&quot;&#x5B;PK_Employee_EmployeeID]&quot; TableReferenceId=&quot;-1&quot; IndexKind=&quot;Clustered&quot; \/&gt;\r\n    &lt;SeekPredicates&gt;\r\n      &lt;SeekPredicateNew&gt;\r\n        &lt;SeekKeys&gt;\r\n          &lt;Prefix ScanType=&quot;EQ&quot;&gt;\r\n            &lt;RangeColumns&gt;\r\n              &lt;ColumnReference Database=&quot;&#x5B;AdventureWorks]&quot; Schema=&quot;&#x5B;HumanResources]&quot; Table=&quot;&#x5B;Employee]&quot; Column=&quot;EmployeeID&quot; \/&gt;\r\n            &lt;\/RangeColumns&gt;\r\n            &lt;RangeExpressions&gt;\r\n              &lt;ScalarOperator ScalarString=&quot;&#x5B;AdventureWorks].&#x5B;HumanResources].&#x5B;Employee].&#x5B;EmployeeID]&quot;&gt;\r\n                &lt;Identifier&gt;\r\n                  &lt;ColumnReference Database=&quot;&#x5B;AdventureWorks]&quot; Schema=&quot;&#x5B;HumanResources]&quot; Table=&quot;&#x5B;Employee]&quot; Column=&quot;EmployeeID&quot; \/&gt;\r\n                &lt;\/Identifier&gt;\r\n              &lt;\/ScalarOperator&gt;\r\n            &lt;\/RangeExpressions&gt;\r\n          &lt;\/Prefix&gt;\r\n        &lt;\/SeekKeys&gt;\r\n      &lt;\/SeekPredicateNew&gt;\r\n    &lt;\/SeekPredicates&gt;\r\n  &lt;\/IndexScan&gt;\r\n&lt;\/RelOp&gt;\r\n<\/pre>\n<p>As a side note, the ShowplanXML uses the IndexScan XML element for both Seeks and Scans.\u00a0 An Index Seek is identified by the SeekPredicates child element, whereas an Index Scan would have a Predicates child element instead. Another important note when dealing with ShowplanXML is that the attribute values of a cached execution plan differ from those of an Actual execution plan collected from SSMS.\u00a0 In the above XML from the plan cache, the Lookup attribute has a value of 1.\u00a0 However, in an Actual plan collected by SSMS, the value would be true as shown in the Actual XML below:<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&lt;IndexScan Lookup=&quot;true&quot; Ordered=&quot;true&quot; ScanDirection=&quot;FORWARD&quot; ForcedIndex=&quot;false&quot; ForceSeek=&quot;false&quot; ForceScan=&quot;false&quot; NoExpandHint=&quot;false&quot;&gt;\r\n<\/pre>\n<p>When building an XML parser for querying the plan cache, the parser must check for a value of 1, not true, when looking for a Lookup attribute in the cached plan XML.\u00a0 Given this information we can build a parser to search the plan cache and find the statements and columns associated with Key Lookups occurring.<\/p>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">\r\n\r\nSET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;\r\n\r\nWITH XMLNAMESPACES\r\n   (DEFAULT 'http:\/\/schemas.microsoft.com\/sqlserver\/2004\/07\/showplan')\r\nSELECT\r\n    n.value('(@StatementText)&#x5B;1]', 'VARCHAR(4000)') AS sql_text,\r\n    n.query('.'),\r\n    i.value('(@PhysicalOp)&#x5B;1]', 'VARCHAR(128)') AS PhysicalOp,\r\n    i.value('(.\/IndexScan\/Object\/@Database)&#x5B;1]', 'VARCHAR(128)') AS DatabaseName,\r\n    i.value('(.\/IndexScan\/Object\/@Schema)&#x5B;1]', 'VARCHAR(128)') AS SchemaName,\r\n    i.value('(.\/IndexScan\/Object\/@Table)&#x5B;1]', 'VARCHAR(128)') AS TableName,\r\n    i.value('(.\/IndexScan\/Object\/@Index)&#x5B;1]', 'VARCHAR(128)') as IndexName,\r\n    i.query('.'),\r\n    STUFF((SELECT DISTINCT ', ' + cg.value('(@Column)&#x5B;1]', 'VARCHAR(128)')\r\n       FROM i.nodes('.\/OutputList\/ColumnReference') AS t(cg)\r\n       FOR  XML PATH('')),1,2,'') AS output_columns,\r\n    STUFF((SELECT DISTINCT ', ' + cg.value('(@Column)&#x5B;1]', 'VARCHAR(128)')\r\n       FROM i.nodes('.\/IndexScan\/SeekPredicates\/SeekPredicateNew\/\/ColumnReference') AS t(cg)\r\n       FOR  XML PATH('')),1,2,'') AS seek_columns,\r\n    i.value('(.\/IndexScan\/Predicate\/ScalarOperator\/@ScalarString)&#x5B;1]', 'VARCHAR(4000)') as Predicate,\r\n\tcp.usecounts,\r\n    query_plan\r\nFROM (  SELECT plan_handle, query_plan\r\n        FROM (  SELECT DISTINCT plan_handle\r\n                FROM sys.dm_exec_query_stats WITH(NOLOCK)) AS qs\r\n        OUTER APPLY sys.dm_exec_query_plan(qs.plan_handle) tp\r\n      ) as tab (plan_handle, query_plan)\r\nINNER JOIN sys.dm_exec_cached_plans AS cp \r\n    ON tab.plan_handle = cp.plan_handle\r\nCROSS APPLY query_plan.nodes('\/ShowPlanXML\/BatchSequence\/Batch\/Statements\/*') AS q(n)\r\nCROSS APPLY n.nodes('.\/\/RelOp&#x5B;IndexScan&#x5B;@Lookup=&quot;1&quot;] and IndexScan\/Object&#x5B;@Schema!=&quot;&#x5B;sys]&quot;]]') as s(i)\r\nOPTION(RECOMPILE, MAXDOP 1);\r\n<\/pre>\n<p>The first CROSS APPLY above breaks out the individual statements so that we can tie the Key Lookup operation to the specific statement that is causing it to occur.\u00a0 The second CROSS APPLY breaks out the actual IndexScan element in the XML and filters out any Key Lookups that are happening in the &#8216;sys&#8217; schema, since many of the system tables have frequent Key Lookup operations that occur.\u00a0 Using the two XML fragments created by the CROSS APPLY operations we can extract the statement, the table and index the lookup operation occurs against, the output columns of the lookup operation and the seek predicate being used to perform the lookup.\u00a0\u00a0 With this information we can look at the indexing on our tables and determine if a change to a non-clustered index to make it covering is warranted to improve performance or not.<\/p>\n<p>Hope this is helpful!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is actually a blog post I thought I&#8217;d written more than two years ago, but this morning when I went looking for it after receiving a question by email\u00a0 I realized that I&#8217;ve never blogged about this before.\u00a0 At PASS Summit 2010 I presented a session on performance tuning SQL Server by digging into [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[31,38,39],"tags":[],"class_list":["post-1744","post","type-post","status-publish","format-standard","hentry","category-plan-cache","category-sql-server-2008","category-sql-server-2012"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Finding Key Lookups inside the Plan Cache - Jonathan Kehayias<\/title>\n<meta name=\"description\" content=\"Demonstrates how to parse the ShowplanXML in the SQL Server plan cache to find Key Lookup operations and identify the statements causing them.\" \/>\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\/jonathan\/finding-key-lookups-inside-the-plan-cache\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Finding Key Lookups inside the Plan Cache - Jonathan Kehayias\" \/>\n<meta property=\"og:description\" content=\"Demonstrates how to parse the ShowplanXML in the SQL Server plan cache to find Key Lookup operations and identify the statements causing them.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.sqlskills.com\/blogs\/jonathan\/finding-key-lookups-inside-the-plan-cache\/\" \/>\n<meta property=\"og:site_name\" content=\"Jonathan Kehayias\" \/>\n<meta property=\"article:published_time\" content=\"2013-04-04T01:24:21+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-04-13T16:55:38+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-content\/uploads\/2013\/04\/image_thumb.png\" \/>\n<meta name=\"author\" content=\"Jonathan Kehayias\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jonathan Kehayias\" \/>\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.sqlskills.com\\\/blogs\\\/jonathan\\\/finding-key-lookups-inside-the-plan-cache\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/finding-key-lookups-inside-the-plan-cache\\\/\"},\"author\":{\"name\":\"Jonathan Kehayias\",\"@id\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/#\\\/schema\\\/person\\\/01c10d94f3648654ef706d5e6305f69c\"},\"headline\":\"Finding Key Lookups inside the Plan Cache\",\"datePublished\":\"2013-04-04T01:24:21+00:00\",\"dateModified\":\"2017-04-13T16:55:38+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/finding-key-lookups-inside-the-plan-cache\\\/\"},\"wordCount\":1051,\"commentCount\":15,\"image\":{\"@id\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/finding-key-lookups-inside-the-plan-cache\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/wp-content\\\/uploads\\\/2013\\\/04\\\/image_thumb.png\",\"articleSection\":[\"Plan Cache\",\"SQL Server 2008\",\"SQL Server 2012\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/finding-key-lookups-inside-the-plan-cache\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/finding-key-lookups-inside-the-plan-cache\\\/\",\"url\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/finding-key-lookups-inside-the-plan-cache\\\/\",\"name\":\"Finding Key Lookups inside the Plan Cache - Jonathan Kehayias\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/finding-key-lookups-inside-the-plan-cache\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/finding-key-lookups-inside-the-plan-cache\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/wp-content\\\/uploads\\\/2013\\\/04\\\/image_thumb.png\",\"datePublished\":\"2013-04-04T01:24:21+00:00\",\"dateModified\":\"2017-04-13T16:55:38+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/#\\\/schema\\\/person\\\/01c10d94f3648654ef706d5e6305f69c\"},\"description\":\"Demonstrates how to parse the ShowplanXML in the SQL Server plan cache to find Key Lookup operations and identify the statements causing them.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/finding-key-lookups-inside-the-plan-cache\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/finding-key-lookups-inside-the-plan-cache\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/finding-key-lookups-inside-the-plan-cache\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/wp-content\\\/uploads\\\/2013\\\/04\\\/image_thumb.png\",\"contentUrl\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/wp-content\\\/uploads\\\/2013\\\/04\\\/image_thumb.png\",\"width\":535,\"height\":214},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/finding-key-lookups-inside-the-plan-cache\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Plan Cache\",\"item\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/category\\\/plan-cache\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Finding Key Lookups inside the Plan Cache\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/#website\",\"url\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/\",\"name\":\"Jonathan Kehayias - The Rambling DBA\",\"description\":\"The Rambling DBA\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/#\\\/schema\\\/person\\\/01c10d94f3648654ef706d5e6305f69c\",\"name\":\"Jonathan Kehayias\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/86630e27f5deecc5c393ea57fc7c3b6a068949f4fd6b5309f81de5a276f12855?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/86630e27f5deecc5c393ea57fc7c3b6a068949f4fd6b5309f81de5a276f12855?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/86630e27f5deecc5c393ea57fc7c3b6a068949f4fd6b5309f81de5a276f12855?s=96&d=mm&r=g\",\"caption\":\"Jonathan Kehayias\"},\"sameAs\":[\"http:\\\/\\\/3.209.169.194\\\/blogs\\\/jonathan\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Finding Key Lookups inside the Plan Cache - Jonathan Kehayias","description":"Demonstrates how to parse the ShowplanXML in the SQL Server plan cache to find Key Lookup operations and identify the statements causing them.","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\/jonathan\/finding-key-lookups-inside-the-plan-cache\/","og_locale":"en_US","og_type":"article","og_title":"Finding Key Lookups inside the Plan Cache - Jonathan Kehayias","og_description":"Demonstrates how to parse the ShowplanXML in the SQL Server plan cache to find Key Lookup operations and identify the statements causing them.","og_url":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/finding-key-lookups-inside-the-plan-cache\/","og_site_name":"Jonathan Kehayias","article_published_time":"2013-04-04T01:24:21+00:00","article_modified_time":"2017-04-13T16:55:38+00:00","og_image":[{"url":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-content\/uploads\/2013\/04\/image_thumb.png","type":"","width":"","height":""}],"author":"Jonathan Kehayias","twitter_misc":{"Written by":"Jonathan Kehayias","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/finding-key-lookups-inside-the-plan-cache\/#article","isPartOf":{"@id":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/finding-key-lookups-inside-the-plan-cache\/"},"author":{"name":"Jonathan Kehayias","@id":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/#\/schema\/person\/01c10d94f3648654ef706d5e6305f69c"},"headline":"Finding Key Lookups inside the Plan Cache","datePublished":"2013-04-04T01:24:21+00:00","dateModified":"2017-04-13T16:55:38+00:00","mainEntityOfPage":{"@id":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/finding-key-lookups-inside-the-plan-cache\/"},"wordCount":1051,"commentCount":15,"image":{"@id":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/finding-key-lookups-inside-the-plan-cache\/#primaryimage"},"thumbnailUrl":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-content\/uploads\/2013\/04\/image_thumb.png","articleSection":["Plan Cache","SQL Server 2008","SQL Server 2012"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.sqlskills.com\/blogs\/jonathan\/finding-key-lookups-inside-the-plan-cache\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/finding-key-lookups-inside-the-plan-cache\/","url":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/finding-key-lookups-inside-the-plan-cache\/","name":"Finding Key Lookups inside the Plan Cache - Jonathan Kehayias","isPartOf":{"@id":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/finding-key-lookups-inside-the-plan-cache\/#primaryimage"},"image":{"@id":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/finding-key-lookups-inside-the-plan-cache\/#primaryimage"},"thumbnailUrl":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-content\/uploads\/2013\/04\/image_thumb.png","datePublished":"2013-04-04T01:24:21+00:00","dateModified":"2017-04-13T16:55:38+00:00","author":{"@id":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/#\/schema\/person\/01c10d94f3648654ef706d5e6305f69c"},"description":"Demonstrates how to parse the ShowplanXML in the SQL Server plan cache to find Key Lookup operations and identify the statements causing them.","breadcrumb":{"@id":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/finding-key-lookups-inside-the-plan-cache\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.sqlskills.com\/blogs\/jonathan\/finding-key-lookups-inside-the-plan-cache\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/finding-key-lookups-inside-the-plan-cache\/#primaryimage","url":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-content\/uploads\/2013\/04\/image_thumb.png","contentUrl":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-content\/uploads\/2013\/04\/image_thumb.png","width":535,"height":214},{"@type":"BreadcrumbList","@id":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/finding-key-lookups-inside-the-plan-cache\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/"},{"@type":"ListItem","position":2,"name":"Plan Cache","item":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/category\/plan-cache\/"},{"@type":"ListItem","position":3,"name":"Finding Key Lookups inside the Plan Cache"}]},{"@type":"WebSite","@id":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/#website","url":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/","name":"Jonathan Kehayias - The Rambling DBA","description":"The Rambling DBA","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/#\/schema\/person\/01c10d94f3648654ef706d5e6305f69c","name":"Jonathan Kehayias","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/86630e27f5deecc5c393ea57fc7c3b6a068949f4fd6b5309f81de5a276f12855?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/86630e27f5deecc5c393ea57fc7c3b6a068949f4fd6b5309f81de5a276f12855?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/86630e27f5deecc5c393ea57fc7c3b6a068949f4fd6b5309f81de5a276f12855?s=96&d=mm&r=g","caption":"Jonathan Kehayias"},"sameAs":["http:\/\/3.209.169.194\/blogs\/jonathan"]}]}},"_links":{"self":[{"href":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-json\/wp\/v2\/posts\/1744","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-json\/wp\/v2\/comments?post=1744"}],"version-history":[{"count":0,"href":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-json\/wp\/v2\/posts\/1744\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-json\/wp\/v2\/media?parent=1744"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-json\/wp\/v2\/categories?post=1744"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-json\/wp\/v2\/tags?post=1744"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}