gpt4 book ai didi

postgresql - 为什么长时间运行的查询在 postgresql 日志中是空白的?

转载 作者:行者123 更新时间:2023-11-29 12:22:31 25 4
gpt4 key购买 nike

我正在运行一个日志 (log_min_duration_statement = 200) 来分析 PostgreSQL 9.0 中的一些慢速查询,但最差查询的语句没有被记录下来。有什么方法可以找出查询的实际内容吗?

(为了简洁和隐私,一些值被替换为 ***。)

2012-06-29 02:10:39 UTC LOG:  duration: 266.658 ms  statement: SELECT *** FROM "oauth_accesstoken" WHERE "oauth_accesstoken"."token" = E'***' 
2012-06-29 02:10:40 UTC LOG: duration: 1797.400 ms statement:
2012-06-29 02:10:49 UTC LOG: duration: 1670.132 ms statement:
2012-06-29 02:10:50 UTC LOG: duration: 354.336 ms statement: SELECT *** FROM ***
...

最佳答案

postgresql.conf 中有一些日志文件目标选项,如下所示。我建议使用 csvlog

log_destination = 'csvlog'  
logging_collector = on
log_directory = '/var/applog/pg_log/1922/'
log_rotation_age = 1d
log_rotation_size = 10MB
log_statement = 'ddl' # none, ddl, mod, all
log_min_duration_statement = 200

进行任何更改后,您需要重新加载 postgresql.conf 文件。

关于postgresql - 为什么长时间运行的查询在 postgresql 日志中是空白的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11255269/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com