简体   繁体   English

用户在 Azure Synapse 专用 SQL 池中执行的查询?

[英]Queries executed in Azure Synapse dedicated SQL Pool by User?

How to get the list of queries executed in Azure Synapse Dedicated SQL Pool by user?如何获取用户在 Azure Synapse Dedicated SQL 池中执行的查询列表?

You can get the query details by either using Azure Query Store service which automatically captures a history of queries, plans, and runtime statistics, and retains these for your review or you can create your custom table in your database to capture all the required details.您可以使用 Azure查询存储服务来获取查询详细信息,该服务会自动捕获查询、计划和运行时统计信息的历史记录,并保留这些以供您查看,或者您可以在数据库中创建自定义表以捕获所有必需的详细信息。

Only Synapse Dedicated pool supports Query Store but it isn't enabled by default for new Azure Synapse Analytics databases.只有 Synapse 专用池支持查询存储,但默认情况下未为新的 Azure Synapse Analytics 数据库启用它。

Use the ALTER DATABASE statement to enable the query store for a given database.使用ALTER DATABASE语句为给定数据库启用查询存储。 For example:例如:

ALTER DATABASE <database_name>
SET QUERY_STORE = ON (OPERATION_MODE = READ_WRITE);

The following query returns information about queries and plans in the Query Store.以下查询返回有关查询存储中的查询和计划的信息。

SELECT Txt.query_text_id, Txt.query_sql_text, Pl.plan_id, Qry.*
FROM sys.query_store_plan AS Pl
INNER JOIN sys.query_store_query AS Qry
    ON Pl.query_id = Qry.query_id
INNER JOIN sys.query_store_query_text AS Txt
    ON Qry.query_text_id = Txt.query_text_id;

On the other side, if you want to create a table to track the history of all the queries, you can refer the answer given by SqlWorldWide on this similar thread .另一方面,如果您想创建一个表来跟踪所有查询的历史记录,您可以参考SqlWorldWide在这个类似线程上给出的答案。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 Azure Synapse 专用/无服务器 SQL 池中使用增量表 - Using Delta Tables in Azure Synapse Dedicated/Serverless SQL Pools Azure 数据工厂将数据从 XML 复制到 SQL 突触池 - Azure Data Factory copy data from XML to SQL Synapse pool 是否可以使用 Azure Synapse Serverless SQL 池过滤动态日期范围? - Is it possible to filter on a dynamic date range with an Azure Synapse Serverless SQL Pool? 如何在 Azure Synapse 无服务器 SQL 池中使用 CETAS 创建外部表时添加自动递增列? - How to add auto incremented columns while creating External Tables using CETAS in Azure Synapse serverless SQL Pool? 如何对 Azure Synapse 中的暂停查询进行故障排除? - How to troubleshoot suspended queries in Azure Synapse? 构建错误 SQL46005:预期 FILESTREAM_ON 但在尝试为 Azure Synapse SQL 池构建数据库项目时遇到 object - Build error SQL46005: Expected FILESTREAM_ON but encountered object instead when trying to build a database project for Azure Synapse SQL pool 在 Azure Synapse 中使用 SQL 声明变量时出错 - Error in declare variable with SQL in Azure Synapse 如何在 Synapse Analytics 无服务器 SQL 池中对行进行随机抽样? - How to do random sampling of rows in Synapse Analytics serverless SQL pool? 如何在 AZURE DW 或 Azure 突触中制作用户或角色特定触发器? - How make user or role specific triggers in AZURE DW or Azure synapse? SQL Server:执行哪些查询? - SQL Server : which queries are executed?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM