amazon-redshift - 如何在redshift中加入sys_query_history和STL_querytext

标签 amazon-redshift

我需要从 sys_query_history 执行的查询的一些信息 喜欢 状态、result_cache_hit、开始时间、结束时间、错误消息

并从 STL_querytext 获取全文

如何连接这两个表,因为这两个表中的 queryid 不同

我正在使用 sys_query_history.transaction_id= STL_querytext.xid 和 sys_query_history.session_id= STL_querytext.pid

但它不起作用,因为用户可以在同一 session 中执行多个查询 在这种情况下,sys_query_history 中的 query_id 与 STL_querytext 中的查询不同

最佳答案

SYS 系统 View 是新的日志记录方法。您无法连接 STL 和 SYS TableView 。与 STL 表相比,Redshift 在 SYS View 中以不同方式记录数据(使用 diff queryid)。 STL和SYS表不能组合使用。

关于amazon-redshift - 如何在redshift中加入sys_query_history和STL_querytext,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/75605595/

相关文章:

amazon-web-services - Redshift 。将逗号分隔的值转换为行

sql - 对于下面的示例,如何在 sql 中进行分区

amazon-redshift - 暂时关闭 redshift 以减少账单

mysql - 如何将字符串传递给 AWS redshift 用户定义的函数?

c# - Azure C# 应用服务 ODBC 连接到 Redshift

amazon-redshift - Redshift内部 "identity"函数的签名

mysql - 在最后一行除外的情况下使用滞后函数

amazon-web-services - 将 PySpark 连接到 AWS Redshift 时出错

mysql - 如何将 csv 数据文件复制到 Amazon RedShift?

mysql - 将数据从 MySql 同步到 Amazon RedShift