DBAtlas · 데이터베이스 운영 아틀라스

재시작 대기 중인 파라미터 및 구성 파일 오류 조회

PostgreSQL파라미터

명령어

-- Parameters changed but not effective until a restart
SELECT name, setting, unit, context, source, sourcefile, pending_restart
FROM pg_settings
WHERE pending_restart;

-- Lines in configuration files that were not applied or have errors
SELECT sourcefile, sourceline, seqno, name, setting, applied, error
FROM pg_file_settings
WHERE NOT applied OR error IS NOT NULL
ORDER BY sourcefile, sourceline;

-- Where does a parameter's effective value come from?
SELECT name, setting, source, sourcefile, sourceline
FROM pg_settings
WHERE name = 'work_mem';

하는 일

파일에서 변경되었지만 재시작을 기다리는 파라미터, 적용되지 않았거나 오류가 있는 구성 파일 줄, 파라미터의 유효 값이 어느 파일/줄에서 오는지 보여 준다.

사용 시점

ALTER SYSTEM이나 postgresql.conf 변경 후 reload가 기대한 효과를 냈는지 확인하고, 계획된 재시작 전 대기 중인 변경을 나열하기 위해.

주의

pg_file_settings는 현재 파일 상태를 읽는다. 파라미터가 여러 곳에 정의되어 있으면 마지막 정의만 applied = true다(postgresql.auto.conf가 마지막에 읽히므로 ALTER SYSTEM이 항상 우선한다). applied = false이고 error가 빈 줄은 다른 정의에 가려진 것이며 오류가 아니다. 재시작이 필요한 파라미터는 error에 'setting could not be applied'를 표시한다. 오류가 있는 파일은 reload 시 일부만 적용될 수 있으므로 변경 후 pg_reload_conf()를 실행한 다음 이 쿼리와 서버 로그를 확인한다. postgresql.auto.conf는 직접 편집하지 말고 ALTER SYSTEM RESET을 사용한다.

DBAtlas에서 열기 →

관련 항목