Databases

Decision to Restart Postgresql Upon Configuration Change

How to determine whether Postgresql requires a restart upon configuration changes?

Anas Anjaria
2 min readAug 24, 2022
Decision to Restart Postgresql Upon Configuration Change
Photo by Emile Perron on Unsplash

UPDATED

You can easily determine whether a configuration setting requires a restart or not by visiting this https://postgresqlco.nf/.

For instance, max_wal_size does not require a restart because restart is false.

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.

The outcome of the given 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.

PostgreSQL

17 stories
Resolving PostgreSQL Production Challenges
Replication conflict — High-level overview
A PostgreSQL cluster hosted on AWS cloud. The cluster consists of two nodes running PostgreSQL with Timescale DB, Patroni for high availability, HAProxy as a load balancer, and a dedicated etcd node.
Want to connect?
https://anasanjaria.bio.link/
Want to subscribe to my newsletter?
https://medium.com/subscribe/@anasanjaria

--

--

Anas Anjaria

I simplify software engineering by sharing practical lessons and insights. My goal is to help early-career developers grow into proficient Software Engineers.