Wednesday, January 5, 2022

How to set a dynamic parameter in a postgreSQL database cluster

As with oracle, some parameters may be set dynamically in a postgreSQL database cluster. A postgreSQL database cluster uses a parameter file called postgres.conf. This file holds the cluster wide parameters. If you set a dynamic parameter using the ALTER SYSTEM SET command, the parameter will be written to yet another file called postgres.auto.conf, which values will always override the ones parameters in the postgres.conf Before the change, postgres.auto.conf look like this:
log_line_prefix = '[%m] – %p %q- %u@%h:%d – %a'
wal_level = 'replica'
hot_standby = 'on'
I then make a change to the system configuration:
alter system set hot_standby_feedback=on;
ALTER SYSTEM
After this change, the file postgres.auto.conf has another entry:
log_line_prefix = '[%m] – %p %q- %u@%h:%d – %a'
wal_level = 'replica'
hot_standby = 'on'
hot_standby_feedback = 'on'
I will then have to reload the database using the function pg_reload_conf() for the new parameter to take effect:
postgres=#  select pg_reload_conf();
 pg_reload_conf
----------------
 t
(1 row)
The current logfile for the postgreSQL database cluster records this fact:
[2022-01-03 14:45:23.127 CET] – 1683 LOG:  received SIGHUP, reloading configuration files
[2022-01-03 14:45:23.129 CET] – 1683 LOG:  parameter "hot_standby_feedback" changed to "on"
For details, check the documentation

No comments:

Post a Comment