<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: SQL SERVER &#8211; Find Most Expensive Queries Using DMV</title>
	<atom:link href="http://blog.sqlauthority.com/2010/05/14/sql-server-find-most-expensive-queries-using-dmv/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sqlauthority.com/2010/05/14/sql-server-find-most-expensive-queries-using-dmv/</link>
	<description>Personal Notes of Pinal Dave</description>
	<lastBuildDate>Fri, 17 May 2013 15:26:57 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Dima</title>
		<link>http://blog.sqlauthority.com/2010/05/14/sql-server-find-most-expensive-queries-using-dmv/#comment-451891</link>
		<dc:creator><![CDATA[Dima]]></dc:creator>
		<pubDate>Mon, 08 Apr 2013 17:24:45 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=8960#comment-451891</guid>
		<description><![CDATA[Hi, thanks for a wonderful query. What is the way to find out which SPID&#039;s are running these queries?. Thanks in advance]]></description>
		<content:encoded><![CDATA[<p>Hi, thanks for a wonderful query. What is the way to find out which SPID&#8217;s are running these queries?. Thanks in advance</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sathish (@apshathish)</title>
		<link>http://blog.sqlauthority.com/2010/05/14/sql-server-find-most-expensive-queries-using-dmv/#comment-421044</link>
		<dc:creator><![CDATA[Sathish (@apshathish)]]></dc:creator>
		<pubDate>Tue, 12 Feb 2013 16:24:55 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=8960#comment-421044</guid>
		<description><![CDATA[Hi all, Is it possible to get top 10 sql for our time frame?]]></description>
		<content:encoded><![CDATA[<p>Hi all, Is it possible to get top 10 sql for our time frame?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sahil bangerwa</title>
		<link>http://blog.sqlauthority.com/2010/05/14/sql-server-find-most-expensive-queries-using-dmv/#comment-411793</link>
		<dc:creator><![CDATA[sahil bangerwa]]></dc:creator>
		<pubDate>Wed, 23 Jan 2013 12:15:55 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=8960#comment-411793</guid>
		<description><![CDATA[update bcz it has to overwrite the data.If any index is on table then it has to modifi that and if that index is clusterd index then that index arrange itself in assinding order.]]></description>
		<content:encoded><![CDATA[<p>update bcz it has to overwrite the data.If any index is on table then it has to modifi that and if that index is clusterd index then that index arrange itself in assinding order.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sondurak</title>
		<link>http://blog.sqlauthority.com/2010/05/14/sql-server-find-most-expensive-queries-using-dmv/#comment-393741</link>
		<dc:creator><![CDATA[sondurak]]></dc:creator>
		<pubDate>Sat, 15 Dec 2012 10:35:52 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=8960#comment-393741</guid>
		<description><![CDATA[The second argument is the starting place. Using the statement start offset and statement end offset, we have to divide by two because the offset is in bytes and the text is Unicode. In this argument only, we must add 1 because the statement_start_offset and statement_end_offset are 0 based whereas the substring function is 1 based. This is correct in this function.]]></description>
		<content:encoded><![CDATA[<p>The second argument is the starting place. Using the statement start offset and statement end offset, we have to divide by two because the offset is in bytes and the text is Unicode. In this argument only, we must add 1 because the statement_start_offset and statement_end_offset are 0 based whereas the substring function is 1 based. This is correct in this function.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shadab Shah</title>
		<link>http://blog.sqlauthority.com/2010/05/14/sql-server-find-most-expensive-queries-using-dmv/#comment-355394</link>
		<dc:creator><![CDATA[Shadab Shah]]></dc:creator>
		<pubDate>Wed, 03 Oct 2012 08:48:05 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=8960#comment-355394</guid>
		<description><![CDATA[Sir, I would like to know why have you done (qs.statement_start_offset/2)+1]]></description>
		<content:encoded><![CDATA[<p>Sir, I would like to know why have you done (qs.statement_start_offset/2)+1</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQL SERVER &#8211; Identify Most Resource Intensive Queries &#8211; SQL in Sixty Seconds #028 &#8211; Video &#171; SQL Server Journey with SQL Authority</title>
		<link>http://blog.sqlauthority.com/2010/05/14/sql-server-find-most-expensive-queries-using-dmv/#comment-355303</link>
		<dc:creator><![CDATA[SQL SERVER &#8211; Identify Most Resource Intensive Queries &#8211; SQL in Sixty Seconds #028 &#8211; Video &#171; SQL Server Journey with SQL Authority]]></dc:creator>
		<pubDate>Wed, 03 Oct 2012 01:31:17 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=8960#comment-355303</guid>
		<description><![CDATA[[...] Get Script to identify resource intensive query from Here [...]]]></description>
		<content:encoded><![CDATA[<p>[...] Get Script to identify resource intensive query from Here [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Girijesh Pandey</title>
		<link>http://blog.sqlauthority.com/2010/05/14/sql-server-find-most-expensive-queries-using-dmv/#comment-355084</link>
		<dc:creator><![CDATA[Girijesh Pandey]]></dc:creator>
		<pubDate>Tue, 02 Oct 2012 07:05:15 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=8960#comment-355084</guid>
		<description><![CDATA[Hi Pinal,

Nice post, quite helpful while working for Query optimization.

Regards,
Girijesh]]></description>
		<content:encoded><![CDATA[<p>Hi Pinal,</p>
<p>Nice post, quite helpful while working for Query optimization.</p>
<p>Regards,<br />
Girijesh</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: MDS</title>
		<link>http://blog.sqlauthority.com/2010/05/14/sql-server-find-most-expensive-queries-using-dmv/#comment-316798</link>
		<dc:creator><![CDATA[MDS]]></dc:creator>
		<pubDate>Sat, 21 Jul 2012 04:21:15 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=8960#comment-316798</guid>
		<description><![CDATA[Does running these DMVs in itself cause any performance overhead. My DBA is of the opinion that running these queries in itself cause an overhead. Can anyone please provide me concrete data/proof that these DMVs are not resource intensive]]></description>
		<content:encoded><![CDATA[<p>Does running these DMVs in itself cause any performance overhead. My DBA is of the opinion that running these queries in itself cause an overhead. Can anyone please provide me concrete data/proof that these DMVs are not resource intensive</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stefano Gioia</title>
		<link>http://blog.sqlauthority.com/2010/05/14/sql-server-find-most-expensive-queries-using-dmv/#comment-278939</link>
		<dc:creator><![CDATA[Stefano Gioia]]></dc:creator>
		<pubDate>Mon, 23 Apr 2012 20:40:35 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=8960#comment-278939</guid>
		<description><![CDATA[Rohit: It works on 2005. If you cant make it work, check the database compatibility. There are a lot of good query DMV Scripts (search for DMV Allstars) 

Vick: Since 2000 doesnt have DMVs, go for the ol&#039; fashioned SQL Profiler or automated scripts that select and record the sysprocesses / DBCC NPUTBUFFER output.]]></description>
		<content:encoded><![CDATA[<p>Rohit: It works on 2005. If you cant make it work, check the database compatibility. There are a lot of good query DMV Scripts (search for DMV Allstars) </p>
<p>Vick: Since 2000 doesnt have DMVs, go for the ol&#8217; fashioned SQL Profiler or automated scripts that select and record the sysprocesses / DBCC NPUTBUFFER output.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rohit Paliwal</title>
		<link>http://blog.sqlauthority.com/2010/05/14/sql-server-find-most-expensive-queries-using-dmv/#comment-277254</link>
		<dc:creator><![CDATA[Rohit Paliwal]]></dc:creator>
		<pubDate>Wed, 18 Apr 2012 11:54:29 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=8960#comment-277254</guid>
		<description><![CDATA[It seems it doesn&#039;t work on 2005 :(]]></description>
		<content:encoded><![CDATA[<p>It seems it doesn&#8217;t work on 2005 :(</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vick</title>
		<link>http://blog.sqlauthority.com/2010/05/14/sql-server-find-most-expensive-queries-using-dmv/#comment-262990</link>
		<dc:creator><![CDATA[Vick]]></dc:creator>
		<pubDate>Wed, 14 Mar 2012 16:52:25 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=8960#comment-262990</guid>
		<description><![CDATA[Any idea for DB running on Sql 2000? Please?]]></description>
		<content:encoded><![CDATA[<p>Any idea for DB running on Sql 2000? Please?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: abhi</title>
		<link>http://blog.sqlauthority.com/2010/05/14/sql-server-find-most-expensive-queries-using-dmv/#comment-247450</link>
		<dc:creator><![CDATA[abhi]]></dc:creator>
		<pubDate>Fri, 03 Feb 2012 11:27:12 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=8960#comment-247450</guid>
		<description><![CDATA[out of following commands which one is most costly:

1)Insert
2)Update
3)delete
4)truncate

If possible please provide the reason also.]]></description>
		<content:encoded><![CDATA[<p>out of following commands which one is most costly:</p>
<p>1)Insert<br />
2)Update<br />
3)delete<br />
4)truncate</p>
<p>If possible please provide the reason also.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sasi</title>
		<link>http://blog.sqlauthority.com/2010/05/14/sql-server-find-most-expensive-queries-using-dmv/#comment-192594</link>
		<dc:creator><![CDATA[Sasi]]></dc:creator>
		<pubDate>Thu, 10 Nov 2011 19:35:38 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=8960#comment-192594</guid>
		<description><![CDATA[check your database compatibility]]></description>
		<content:encoded><![CDATA[<p>check your database compatibility</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Adam Durr (@SQLClimber)</title>
		<link>http://blog.sqlauthority.com/2010/05/14/sql-server-find-most-expensive-queries-using-dmv/#comment-184245</link>
		<dc:creator><![CDATA[Adam Durr (@SQLClimber)]]></dc:creator>
		<pubDate>Thu, 27 Oct 2011 17:33:47 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=8960#comment-184245</guid>
		<description><![CDATA[Check the compatibility level of the database. If its in SQL 2000 mode then this query will not work.]]></description>
		<content:encoded><![CDATA[<p>Check the compatibility level of the database. If its in SQL 2000 mode then this query will not work.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: madhivanan</title>
		<link>http://blog.sqlauthority.com/2010/05/14/sql-server-find-most-expensive-queries-using-dmv/#comment-147992</link>
		<dc:creator><![CDATA[madhivanan]]></dc:creator>
		<pubDate>Wed, 13 Jul 2011 13:20:45 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=8960#comment-147992</guid>
		<description><![CDATA[It is based on the actual data stored.]]></description>
		<content:encoded><![CDATA[<p>It is based on the actual data stored.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: suresh</title>
		<link>http://blog.sqlauthority.com/2010/05/14/sql-server-find-most-expensive-queries-using-dmv/#comment-147915</link>
		<dc:creator><![CDATA[suresh]]></dc:creator>
		<pubDate>Wed, 13 Jul 2011 06:50:41 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=8960#comment-147915</guid>
		<description><![CDATA[Morning Pinal,

i hava a doubt .. how the memory allcation will be in creation of table in sql server...

create table test
(
   name varchar(10)--
)

means in sql server the memory allocation will be like bit or bytes...

if i declared name varchar(10) the memory allocation will be based on the seze or byte wise

Plz give me earlier responce..

Regards
Suresh..]]></description>
		<content:encoded><![CDATA[<p>Morning Pinal,</p>
<p>i hava a doubt .. how the memory allcation will be in creation of table in sql server&#8230;</p>
<p>create table test<br />
(<br />
   name varchar(10)&#8211;<br />
)</p>
<p>means in sql server the memory allocation will be like bit or bytes&#8230;</p>
<p>if i declared name varchar(10) the memory allocation will be based on the seze or byte wise</p>
<p>Plz give me earlier responce..</p>
<p>Regards<br />
Suresh..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jorge Rosete</title>
		<link>http://blog.sqlauthority.com/2010/05/14/sql-server-find-most-expensive-queries-using-dmv/#comment-142766</link>
		<dc:creator><![CDATA[Jorge Rosete]]></dc:creator>
		<pubDate>Tue, 21 Jun 2011 16:06:03 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=8960#comment-142766</guid>
		<description><![CDATA[I ran the script on a database but the result was empty, i ran again in another database and works why is that? the statistics are enabled]]></description>
		<content:encoded><![CDATA[<p>I ran the script on a database but the result was empty, i ran again in another database and works why is that? the statistics are enabled</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robin</title>
		<link>http://blog.sqlauthority.com/2010/05/14/sql-server-find-most-expensive-queries-using-dmv/#comment-128681</link>
		<dc:creator><![CDATA[Robin]]></dc:creator>
		<pubDate>Wed, 13 Apr 2011 15:02:31 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=8960#comment-128681</guid>
		<description><![CDATA[Thank you for the script Pinal.  Do you have a workaround for SQL 2008?  It doesn&#039;t appear to work with .sql_handle&#039;.]]></description>
		<content:encoded><![CDATA[<p>Thank you for the script Pinal.  Do you have a workaround for SQL 2008?  It doesn&#8217;t appear to work with .sql_handle&#8217;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rob</title>
		<link>http://blog.sqlauthority.com/2010/05/14/sql-server-find-most-expensive-queries-using-dmv/#comment-119205</link>
		<dc:creator><![CDATA[rob]]></dc:creator>
		<pubDate>Fri, 18 Feb 2011 16:54:47 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=8960#comment-119205</guid>
		<description><![CDATA[How can I add the database name to this query?]]></description>
		<content:encoded><![CDATA[<p>How can I add the database name to this query?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: vipul</title>
		<link>http://blog.sqlauthority.com/2010/05/14/sql-server-find-most-expensive-queries-using-dmv/#comment-117748</link>
		<dc:creator><![CDATA[vipul]]></dc:creator>
		<pubDate>Wed, 09 Feb 2011 17:00:08 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=8960#comment-117748</guid>
		<description><![CDATA[Dear Sir / Madam

I have problem in sql server 2008

(1) I am using service brokar for messaging purpose , my application every three second read message ( binary to xml ) and send to web client this method lot of resource use , then any alternative method available in sql server ?

(2) in statics update lot of _wa_sys file this is effect performance or not ? if performance effect then delete or not ?
Please tell soluation as soon as possible ...



Regards]]></description>
		<content:encoded><![CDATA[<p>Dear Sir / Madam</p>
<p>I have problem in sql server 2008</p>
<p>(1) I am using service brokar for messaging purpose , my application every three second read message ( binary to xml ) and send to web client this method lot of resource use , then any alternative method available in sql server ?</p>
<p>(2) in statics update lot of _wa_sys file this is effect performance or not ? if performance effect then delete or not ?<br />
Please tell soluation as soon as possible &#8230;</p>
<p>Regards</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sudeep</title>
		<link>http://blog.sqlauthority.com/2010/05/14/sql-server-find-most-expensive-queries-using-dmv/#comment-115045</link>
		<dc:creator><![CDATA[Sudeep]]></dc:creator>
		<pubDate>Fri, 28 Jan 2011 19:52:55 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=8960#comment-115045</guid>
		<description><![CDATA[just delete that &#039;– &#039; and type that again.]]></description>
		<content:encoded><![CDATA[<p>just delete that &#8216;– &#8216; and type that again.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Todd</title>
		<link>http://blog.sqlauthority.com/2010/05/14/sql-server-find-most-expensive-queries-using-dmv/#comment-80582</link>
		<dc:creator><![CDATA[Todd]]></dc:creator>
		<pubDate>Sat, 17 Jul 2010 09:55:00 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=8960#comment-80582</guid>
		<description><![CDATA[Gaurav,
 
I get a syntax error on both of your queries:
Msg 102, Level 15, State 1, Line 8
Incorrect syntax near &#039;-&#039;.]]></description>
		<content:encoded><![CDATA[<p>Gaurav,</p>
<p>I get a syntax error on both of your queries:<br />
Msg 102, Level 15, State 1, Line 8<br />
Incorrect syntax near &#8216;-&#8217;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQLAuthority News – Monthly Roundup of Best SQL Posts Journey to SQL Authority with Pinal Dave</title>
		<link>http://blog.sqlauthority.com/2010/05/14/sql-server-find-most-expensive-queries-using-dmv/#comment-73938</link>
		<dc:creator><![CDATA[SQLAuthority News – Monthly Roundup of Best SQL Posts Journey to SQL Authority with Pinal Dave]]></dc:creator>
		<pubDate>Mon, 31 May 2010 01:32:19 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=8960#comment-73938</guid>
		<description><![CDATA[[...] SERVER – Get Latest SQL Query for Sessions – DMV  SQL SERVER – Find Most Expensive Queries Using DMV SQL SERVER – List All the DMV and DMF on [...]]]></description>
		<content:encoded><![CDATA[<p>[...] SERVER – Get Latest SQL Query for Sessions – DMV  SQL SERVER – Find Most Expensive Queries Using DMV SQL SERVER – List All the DMV and DMF on [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gaurav Mittal</title>
		<link>http://blog.sqlauthority.com/2010/05/14/sql-server-find-most-expensive-queries-using-dmv/#comment-71434</link>
		<dc:creator><![CDATA[Gaurav Mittal]]></dc:creator>
		<pubDate>Tue, 18 May 2010 14:39:27 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=8960#comment-71434</guid>
		<description><![CDATA[Here is what the scripts I have...this gives the original source of the query which helps in making any changes to query

--Queries taking longest elapsed time:
SELECT TOP 10
    qs.total_elapsed_time / qs.execution_count / 1000000.0 AS average_seconds,
    qs.total_elapsed_time / 1000000.0 AS total_seconds,
    qs.execution_count,
    SUBSTRING (qt.text,qs.statement_start_offset/2, 
         (CASE WHEN qs.statement_end_offset = -1 
            THEN LEN(CONVERT(NVARCHAR(MAX), qt.text)) * 2 
          ELSE qs.statement_end_offset END - qs.statement_start_offset)/2) AS individual_query,
    o.name AS object_name,
    DB_NAME(qt.dbid) AS database_name
  FROM sys.dm_exec_query_stats qs
    CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) as qt
    LEFT OUTER JOIN sys.objects o ON qt.objectid = o.object_id
where qt.dbid = DB_ID()
  ORDER BY average_seconds DESC;


--Queries doing most I/O:

SELECT TOP 10
    (total_logical_reads + total_logical_writes) / qs.execution_count AS average_IO,
    (total_logical_reads + total_logical_writes) AS total_IO,
    qs.execution_count AS execution_count,
    SUBSTRING (qt.text,qs.statement_start_offset/2, 
         (CASE WHEN qs.statement_end_offset = -1 
            THEN LEN(CONVERT(NVARCHAR(MAX), qt.text)) * 2 
          ELSE qs.statement_end_offset END - qs.statement_start_offset)/2) AS indivudual_query,
    o.name AS object_name,
    DB_NAME(qt.dbid) AS database_name
  FROM sys.dm_exec_query_stats qs
    CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) as qt
    LEFT OUTER JOIN sys.objects o ON qt.objectid = o.object_id
where qt.dbid = DB_ID()
  ORDER BY average_IO DESC;]]></description>
		<content:encoded><![CDATA[<p>Here is what the scripts I have&#8230;this gives the original source of the query which helps in making any changes to query</p>
<p>&#8211;Queries taking longest elapsed time:<br />
SELECT TOP 10<br />
    qs.total_elapsed_time / qs.execution_count / 1000000.0 AS average_seconds,<br />
    qs.total_elapsed_time / 1000000.0 AS total_seconds,<br />
    qs.execution_count,<br />
    SUBSTRING (qt.text,qs.statement_start_offset/2,<br />
         (CASE WHEN qs.statement_end_offset = -1<br />
            THEN LEN(CONVERT(NVARCHAR(MAX), qt.text)) * 2<br />
          ELSE qs.statement_end_offset END &#8211; qs.statement_start_offset)/2) AS individual_query,<br />
    o.name AS object_name,<br />
    DB_NAME(qt.dbid) AS database_name<br />
  FROM sys.dm_exec_query_stats qs<br />
    CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) as qt<br />
    LEFT OUTER JOIN sys.objects o ON qt.objectid = o.object_id<br />
where qt.dbid = DB_ID()<br />
  ORDER BY average_seconds DESC;</p>
<p>&#8211;Queries doing most I/O:</p>
<p>SELECT TOP 10<br />
    (total_logical_reads + total_logical_writes) / qs.execution_count AS average_IO,<br />
    (total_logical_reads + total_logical_writes) AS total_IO,<br />
    qs.execution_count AS execution_count,<br />
    SUBSTRING (qt.text,qs.statement_start_offset/2,<br />
         (CASE WHEN qs.statement_end_offset = -1<br />
            THEN LEN(CONVERT(NVARCHAR(MAX), qt.text)) * 2<br />
          ELSE qs.statement_end_offset END &#8211; qs.statement_start_offset)/2) AS indivudual_query,<br />
    o.name AS object_name,<br />
    DB_NAME(qt.dbid) AS database_name<br />
  FROM sys.dm_exec_query_stats qs<br />
    CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) as qt<br />
    LEFT OUTER JOIN sys.objects o ON qt.objectid = o.object_id<br />
where qt.dbid = DB_ID()<br />
  ORDER BY average_IO DESC;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ramdas</title>
		<link>http://blog.sqlauthority.com/2010/05/14/sql-server-find-most-expensive-queries-using-dmv/#comment-70874</link>
		<dc:creator><![CDATA[Ramdas]]></dc:creator>
		<pubDate>Fri, 14 May 2010 17:55:51 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=8960#comment-70874</guid>
		<description><![CDATA[thanks for the script, do you know if there is a dmv which is equivalent to sp_who2.
Thank you]]></description>
		<content:encoded><![CDATA[<p>thanks for the script, do you know if there is a dmv which is equivalent to sp_who2.<br />
Thank you</p>
]]></content:encoded>
	</item>
</channel>
</rss>
