Anas Anjaria
Anas Anjaria's blog

Follow

Anas Anjaria's blog

Follow
Whether to Restart Postgresql Upon Configuration Change

Photo by Clément Hélardot on Unsplash

Whether to Restart Postgresql Upon Configuration Change

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

Anas Anjaria's photo
Anas Anjaria
·Sep 7, 2022·

1 min read

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 the Postgres email list [1]. Hence I am sharing it in this post.


Imaging we want to update max_slot_wal_keep_size config parameter. Therefore, 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';

Thanks for reading.

Originally posted on medium

Resources

[1] postgres mailing list


Want to connect?

anasanjaria.bio.link

 
Share this