﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Article Discussions / Article Discussions by Author / Discuss content posted by ericzbeard  / Queries, Plans, and Indexes / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Tue, 18 Jun 2013 20:01:13 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Queries, Plans, and Indexes</title><link>http://www.sqlservercentral.com/Forums/Topic544845-1354-1.aspx</link><description>That did it.  Thanks for the quick response and the fix.</description><pubDate>Tue, 18 Nov 2008 10:48:37 GMT</pubDate><dc:creator>Michael Lynn</dc:creator></item><item><title>RE: Queries, Plans, and Indexes</title><link>http://www.sqlservercentral.com/Forums/Topic544845-1354-1.aspx</link><description>Something weird is happening with hidden characters in the site's text box control.  I copy-pasted the script and had to delete a bunch of white space to get it to work (even though it looks the same).Try this version:/*This query gets all queries, their query plans, and all indexes included in those plans.Authors:            Eric Z. Beard, eric@loopfx.com, ericzbeard@yahoo.com                        (borrowed some stuff from http://mohammedu.spaces.live.com/Blog/cns!6699CF8ADD3D4F67!325.entry,                             Greg Lindwood? Uma Chandran?)Date of Origin:        July, 2008*/use master;;with xmlnamespaces('http://schemas.microsoft.com/sqlserver/2004/07/showplan' as s)select st.text, qp.query_plan, qp_objects.qp_obj_schema, qp_objects.qp_obj_table, qp_objects.qp_obj_indexfrom ( select s.sql_handle, s.plan_handle, max(s.execution_count) as ec, max(s.total_logical_reads) as tlr from sys.dm_exec_query_stats as s group by s.sql_handle, s.plan_handle) as qscross apply sys.dm_exec_query_plan(qs.plan_handle) as qpcross apply sys.dm_exec_sql_text(qs.sql_handle) as stcross apply (select obj_nodes.value('@Schema', 'nvarchar(130)') as qp_obj_schema , obj_nodes.value('@Table', 'nvarchar(130)') as qp_obj_table, obj_nodes.value('@Index', 'nvarchar(130)') as qp_obj_indexfrom qp.query_plan.nodes('//s:Object[@Schema != "[sys]" and @Index and local-name(parent::node()) != "Update"]') as qry_plan(obj_nodes) ) as qp_objects;</description><pubDate>Tue, 18 Nov 2008 10:42:24 GMT</pubDate><dc:creator>ericzbeard</dc:creator></item><item><title>RE: Queries, Plans, and Indexes</title><link>http://www.sqlservercentral.com/Forums/Topic544845-1354-1.aspx</link><description>I am getting the following error messages when executing your query.Msg 102, Level 15, State 1, Line 18Incorrect syntax near ' '.Msg 156, Level 15, State 1, Line 26Incorrect syntax near the keyword 'as'.Msg 102, Level 15, State 1, Line 31Incorrect syntax near ' '.</description><pubDate>Tue, 18 Nov 2008 09:57:17 GMT</pubDate><dc:creator>Michael Lynn</dc:creator></item><item><title>Queries, Plans, and Indexes</title><link>http://www.sqlservercentral.com/Forums/Topic544845-1354-1.aspx</link><description>Comments posted to this topic are about the item [B]&lt;A HREF="/scripts/query+plan/63916/"&gt;Queries, Plans, and Indexes&lt;/A&gt;[/B]</description><pubDate>Thu, 31 Jul 2008 22:36:04 GMT</pubDate><dc:creator>ericzbeard</dc:creator></item></channel></rss>