PostgreSQL引數的檢視和修改
1.檢視引數檔案的位置
postgres=# show config_file; config_file --------------------------------------- /usr/local/pgsql/data/postgresql.conf (1 row)
postgres=# show hba_file; hba_file ----------------------------------- /usr/local/pgsql/data/pg_hba.conf (1 row)
postgres=# show ident_file; ident_file ------------------------------------- /usr/local/pgsql/data/pg_ident.conf (1 row)
2.檢視當前會話的引數值
postgres=# show all; 。。。。。。
postgres=# show archive_mode; archive_mode -------------- off (1 row)
3.修改pg的引數值
對於9.5以後的版本,可以通過檢視pg_file_settings檢視你設定的引數是否生效。例如如果你設定了一個引數需要重啟資料庫才能生效或者設定錯誤,那麼在此字典中會出現報錯。
對於9.4以後的版本,你還可以使用alter system 命令修改引數。使用alter system命令將修改postgresql.auto.conf檔案,而不是postgresql.conf,這樣可以很好的保護postgresql.conf檔案,加入你使用很多alter system命令後搞的一團糟,那麼你只需要刪除postgresql.auto.conf,再重新載入即可。
使用pg_ctl reload重新load配置檔案,再檢視引數值: