Today I am sharing another useful query often required during performance tuning/Optimization phase of the project.The query makes use of system DMV’s and DMF’s provided by SQL server.Open new query window in SQL Server and fire the below query by passing the respective database in the where clause.For this example,I have used Adventure Works as my database.You can modify it as per your requirement.
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
SELECT SUM(qs.total_logical_reads) AS [Total Reads]
, SUM(qs.total_logical_writes) AS [Total Writes]
, DB_NAME(qt.dbid) AS DatabaseName
FROM sys.dm_exec_query_stats qs
CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) as qt
WHERE DB_NAME(qt.dbid) = ‘AdventureWorks’
GROUP BY DB_NAME(qt.dbid)
I would like to have feedback from my blog readers.
Please post your feedback, question, or comments about this article.