当前位置: 首页 > 工具软件 > pgFouine > 使用案例 >

使用 pgfouine 分析 postgresql的log

赏星河
2023-12-01
使用 pgfouine 分析 postgresql的log文件
通过记录和分析postgrsql的log文件,可以比较容易的找出哪些SQL的执行时间长。但是手工分析会很累,而且不准确。不过有了pgfouine的帮助,事情就简单多了。

注意,在使用pgfouine之前,要适当修改postgresql.conf的相关配置,主要是以下几项:


log_min_duration_statement = 0
log_connections = off
log_duration = on
log_line_prefix = '%t [%p]: [%l-1] '
log_statement = 'all'


由于我使用stderr记录Log,尤其要注意log_line_prefix的设置,否则pgfouine会报错。

pgfouine -file /storage/syslog/postgresql.log > /storage/www/09082.htm
 类似资料: