How to get database name from Synapse serverless SQL pool query history

Foster, Gwendolyn 0 Reputation points
2024-12-16T12:30:26.8766667+00:00

I have used the DMVs to get the Synapse serverless SQL pool query history and Synapse Studio. I do see in the query text listing that shows the from statement with the name of the view <schema>.<view name> but I do not see the data source (i.e. database) identified. Where would I find that information captured?

Azure Synapse Analytics
Azure Synapse Analytics
An Azure analytics service that brings together data integration, enterprise data warehousing, and big data analytics. Previously known as Azure SQL Data Warehouse.
5,118 questions
{count} votes

1 answer

Sort by: Most helpful
  1. phemanth 12,895 Reputation points Microsoft Vendor
    2024-12-16T19:28:59.4833333+00:00

    @Foster, Gwendolyn

    Thanks for using MS Q&A platform and posting your query.

    To identify the database name from the Synapse serverless SQL pool query history, you can use the following methods:

    1. Dynamic Management Views (DMVs): While DMVs provide extensive details about query execution, they might not directly show the database name. However, you can use the sys.dm_exec_requests and sys.dm_exec_query_stats DMVs to gather more context about the queries.
    2. Query Store: If enabled, the Query Store can provide insights into query performance and history. You can enable it using the following command:
         ALTER DATABASE <database_name> SET QUERY_STORE = ON;
         
      
      This will help you track queries and their associated databases.
    3. Azure Log Analytics: By integrating Synapse with Azure Log Analytics, you can query the SynapseBuiltinSqlPoolRequestsEnded table to get detailed logs, including the database context. User's image
    4. Synapse Studio Monitor Hub: The Monitor Hub in Synapse Studio provides a visual interface to monitor SQL requests. You can customize the columns to include more details about the queries, which might help in identifying the database.

    User's image

    I hope these steps help you resolve the issue. Please Let me know if issue persists.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.