Skip to main content

Profiling queries to Azure SQL DB


Christian Hauggaard
Community Manager
Forum|alt.badge.img+5

When using Azure SQL DB with TimeXtender, you may query sys.query_store_query_text system catalog view which contains the Transact-SQL text.  An example is shown below:

SELECT TOP 100
                qt.query_sql_text As [Query Text]
              , q.query_id As [Query Id]
              , qt.query_text_id As [Query Text Id]
              , p.plan_id As [Plan Id]
              , SwitchOffset(rs.last_execution_time, '-05:00') As [Last Execution Time]
FROM   sys.query_store_query_text AS qt
INNER JOIN sys.query_store_query AS q ON qt.query_text_id = q.query_text_id
INNER JOIN sys.query_store_plan AS p ON q.query_id = p.query_id
INNER JOIN sys.query_store_runtime_stats AS rs ON p.plan_id = rs.plan_id
ORDER BY rs.last_execution_time DESC;

Below is an example output

For more information, review Microsoft documentation:

Querying the SQL Server System Catalog FAQ - SQL Server | Microsoft Docs

Did this topic help you find an answer to your question?

0 replies

Be the first to reply!

Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings