時(shí)間:2024-02-05 12:47作者:下載吧人氣:23
PostgreSQL 開(kāi)啟慢SQL捕獲在排查問(wèn)題時(shí)是個(gè)很有效的手段。根據(jù)慢SQL讓我在工作中真正解決了實(shí)際問(wèn)題,很有幫助。
PostgreSQL 日志支持的輸出格式有 stderr(默認(rèn))、csvlog 、syslog
一般的錯(cuò)誤跟蹤,只需在配置文件 【postgresql.conf】簡(jiǎn)單設(shè)置幾個(gè)參數(shù),當(dāng)然還有錯(cuò)誤級(jí)別等要設(shè)置。
logging_collector = on
log_destination = ‘stderr’
log_directory = ‘log’
log_filename = ‘postgresql-%Y-%m-%d_%H%M%S.log’
SELECT
name,
setting,
vartype,
boot_val,
reset_val
FROM pg_settings
where name in(‘logging_collector’,’log_destination’,’log_directory’,’log_filename’);
網(wǎng)友評(píng)論