SQL Server offers a lot of system views which allow to get information about each instance without interfering in system tables. All those system views are located in hidden system datadabase name 'Resource'.
All system views can be divided into at least two groups:
For example:
SELECT * FROM sys.dm_exec_sql_text (0x1000003434DF44345323000000000000AFF0000)
So now it`s time to know how to get themost chargeable query to the SQL Server engine.
SELECT TOP (20) qs.max_logical_reads, st.[text]
FROM sys.dm_exec_query_stats AS qs
CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle ) AS st
ORDER BY qs.max_logical_reads DESC;
Thank You.
All system views can be divided into at least two groups:
- Structure views - which storing information about SQLSERVER properties and custom structure, and begins with schema INFORMATIN_SCHEMA.* . (compilant with ISO)
- Dynamic views - storing information at runtime from last time instance starts; this begins with sys.dm_*
- session_id: represent the IDs of all current opened session; note that session ID is presented in each query tab in Managment Studio (ex. 52).
- most_recent_sql_handle: a handle to the most recent executed query for single session ID.
For example:
SELECT * FROM sys.dm_exec_sql_text (0x1000003434DF44345323000000000000AFF0000)
So now it`s time to know how to get themost chargeable query to the SQL Server engine.
SELECT TOP (20) qs.max_logical_reads, st.[text]
FROM sys.dm_exec_query_stats AS qs
CROSS APPLY sys.dm_exec_sql_text(qs.sql_
ORDER BY qs.max_logical_reads DESC;
Thank You.