PostgreSQL设置log_statement日志记录

alter system set log_statement= 'all'; 
SELECT pg_reload_conf();
show log_statement;  
show log_min_duration_statement;

cd /var/lib/pgsql/11/data/log

more postgresql-Thu.log

2019-07-18 11:12:29.934 CST [6039] 日志:  接收到 SIGHUP, 重载配置文件
2019-07-18 11:12:29.937 CST [6039] 日志:  参数 "log_statement"被改为"all"
2019-07-18 11:12:34.609 CST [7244] 日志:  执行 : show log_statement
2019-07-18 11:13:02.949 CST [7245] 日志:  执行 : SELECT x.oid,x.relname,x.relnamespace,x.relkind FROM pg_catalog.pg_class x WHERE x.relkind in('r','v','m') AND
 x.relname ILIKE $1  AND x.relnamespace IN ($2,$3) ORDER BY x.relname LIMIT 10
2019-07-18 11:13:02.949 CST [7245] 详细信息:  参数: $1 = 'log_min_duration_statement', $2 = '2200', $3 = '11'
2019-07-18 11:13:02.970 CST [7245] 日志:  执行 : SELECT DISTINCT x.oid,x.proname,x.pronamespace FROM pg_catalog.pg_proc x WHERE x.proname ILIKE $1 AND x.pronam
e NOT LIKE '\_%' AND x.pronamespace IN ($2,$3) ORDER BY x.proname LIMIT 10
2019-07-18 11:13:02.970 CST [7245] 详细信息:  参数: $1 = 'log_min_duration_statement', $2 = '2200', $3 = '11'
2019-07-18 11:13:07.201 CST [7244] 日志:  执行 : show log_min_duration_statement

你可能感兴趣的:(PostgreSQL设置log_statement日志记录)