14
8

More than 5 years have passed since last update.

PostgreSQL の設定値の項目ごとに reload で反映できるか確認する

Last updated at Posted at 2017-09-25

tl;dr

以下のSQLをpostgresユーザーで叩いて context が
sighup なら その項目は reload で反映される

select name, context from pg_settings;

はじめに

  • walログのサイズなど運用が始まってから値を修正したい場合があると思います。
  • レプリケーションを組んでいる場合、おいそれとPostgresを再起動できません。
  • そこで、postgres.conf に記述するような設定値の中でも適用するのに再起動が必要なのか reload で問題ないのかを知る方法を調べました。

pg_settings

参考: https://www.postgresql.jp/document/9.6/html/view-pg-settings.html
* 上記リンク先にあるとおり、 pg_settings view で postgres 各種の設定値は管理されています。
* そこで、context カラムの値を確認することで、 適用に再起動が必要かどうか確認できます。

備考

なお、以下のように setting の値も出力させれば 今どのような値が設定されているかも確認できます。

select name, setting, context from pg_settings;
14
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
14
8