1.全局設置
修改配置postgres.conf:
log_min_duration_statement=5000
然后加載配置:
postgres=# select pg_reload_conf()
postgres=# show log_min_duration_statement; log_min_duration_statement ---------------------------- 5s (1 row)
2.也可以針對某個用戶或者某數據庫進行設置
postgres=# alter database test set log_min_duration_statement=5000;