postgresql - 为什么在没有查询的情况下记录持续时间?
问题描述
我在 postgresql.conf 中启用了这个参数:
log_statement = 'all'
logging_collector = on
log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log'
log_directory = 'pg_log'
现在我看到了:
2020-08-26 11:05:33.151 UTC [29051] postgres@mydb LOG: duration: 134.300 ms
2020-08-26 11:05:33.475 UTC [29050] postgres@mydb LOG: duration: 1015.984 ms
2020-08-26 11:05:33.601 UTC [29041] postgres@mydb LOG: duration: 1149.833 ms
2020-08-26 11:05:34.815 UTC [29053] postgres@mydb LOG: duration: 2354.413 ms
2020-08-26 11:05:39.963 UTC [29056] postgres@mydb LOG: duration: 7495.109 ms
2020-08-26 11:05:39.971 UTC [29054] postgres@mydb LOG: duration: 7506.584 ms
2020-08-26 11:05:39.976 UTC [29055] postgres@mydb LOG: duration: 7514.726 ms
2020-08-26 11:05:40.101 UTC [29058] postgres@mydb LOG: duration: 7629.628 ms
2020-08-26 11:05:40.450 UTC [29057] postgres@mydb LOG: duration: 7973.784 ms
2020-08-26 11:05:41.293 UTC [29059] postgres@mydb LOG: duration: 8820.805 ms
我想知道哪个查询需要这么长时间。
Postgresql 10 Ubuntu 18.04.2 LTS
解决方案
不要使用log_duration
和log_statement = 'all'
。
放
log_min_duration_statement = 0
你有你想要的。
推荐阅读
- apache-spark - 查看 Spark 流中的列值
- node.js - IISNode 使用 httpErrors="Passthrough" 关闭自定义错误不起作用
- java - 如何在 Java 中广播 HLS?
- java - android studio中的Java与普通Java完全一样吗?
- mysql - 如何在 root 用户上允许远程 MySQL 连接?
- android - 在android renderscript中使用大数据数组时等待阻塞GC ProfileSaver
- firebase - “AngularFireDatabase”类型上不存在属性“集合”?
- data-visualization - 如何在 Google Data Studio 中按维度分隔 Metric?
- php - 当laravel中的第一个索引数据非常大时,我如何使用解码的json数据
- php - 无法从谷歌电子表格中获取 json?