Databases
Decision to Restart Postgresql Upon Configuration Change
How to determine whether Postgresql requires a restart upon configuration changes?
I encountered a situation where I needed to update some configuration settings for PostgresSQL. However, I was unsure whether it required a restart upon configuration change.
Restarting the service means downtime and it’s not feasible for the production system. That’s why it’s a crucial decision.
Upon research, I found a solution via Postgres email list [1], so I am sharing it in this post.
Imaging we want to update max_slot_wal_keep_size
config parameter. So we will run the following query.
select pending_restart , context , name, setting
from pg_catalog.pg_settings
where name = 'max_slot_wal_keep_size';
Here is the outcome of the above query.
pending_restart
will tell you whether you need to restart the service or not. According to this mailing list [1],
when the context is postmaster, it requires a restart otherwise not.
Also,
You will immediately observe a change in the configuration when it does not require a restart as opposed to those that require a restart.
You can find a list of parameters that requires a restart using the following query.
select pending_restart , context , name, setting
from pg_catalog.pg_settings
where context = 'postmaster';
Resources
[1] https://www.postgresql.org/message-id/80920AC4-56A3-4E4F-9AF2-7E7A8635F0D2@redzonesoftware.com
If you enjoyed this post, you might also like my database series.


Want to connect?
https://anasanjaria.bio.link/Want to subscribe to my newsletter?
https://medium.com/subscribe/@anasanjaria