AWS Redshift Serverless 完全执行的查询

问题描述 投票:0回答:1

我们正在尝试使用 Redshift Serverless。它显示查询历史记录存储在表sys_query_history中。 但看表,

query_text
字段有 4000 个字符的限制。他们会截断查询。是否有另一种方法可以在 Redshift Serverless 中获取完整执行的查询?

amazon-redshift amazon-redshift-serverless
1个回答
0
投票

您可以执行如下操作来获取所有文本:

SELECT s.query_id, t.text, elapsed_time_m, execution_time_m, queue_time_m, compile_time_m,planning_time_m, lock_wait_time_m, s.start_time, s.end_time
FROM (
    SELECT query_text, elapsed_time / (60 * 1000000.0) elapsed_time_m, 
            execution_time / (60 * 1000000.0) execution_time_m, 
            queue_time / (60 * 1000000.0) queue_time_m,
            compile_time / (60 * 1000000.0) compile_time_m,
            planning_time / (60 * 1000000.0) planning_time_m,
            lock_wait_time / (60 * 1000000.0) lock_wait_time_m,
            user_id, start_time, end_time,
            query_id, query_type
    FROM SYS_QUERY_HISTORY
    ORDER BY elapsed_time DESC
    LIMIT 1000
) s
JOIN sys_query_text t
ON s.query_id = t.query_id
ORDER BY s.query_id, t.sequence
© www.soinside.com 2019 - 2024. All rights reserved.