Reloading the PostgreSQL configuration without restarting the entire database can be efficiently achieved using the
pg_ctl reload command. Performing Postgres reload config is a simple one-liner and should be part of your toolbox.
Table of Contents
Why is Postgres Reload Config Important?
If you are making modifications to the Postgres configuration file postgresql.conf (or similar), and you want to new settings to take effect, reload Postgres config without restart in one of the ways shown below. Another similar command essential to PostgreSQL, is to reload pg_hba.conf.
Method 1: From the command-line shell
From the command-line prompt on your Linux server, run the following command:
su - postgres /usr/bin/pg_ctl reload
Method 2: Using psql
From the command-line run the psql command and run the following SQL statement:
Method 3: Using systemctl reload postgresql
Using systemctl to reload the PostgreSQL configuration is a method common in Linux-based systems. In order to reload the PostgreSQL configuration without interrupting the database service, you simply need to type
sudo systemctl reload postgresql in the command line. This command tells the system to load the latest configuration changes. It’s an effective way of ensuring your PostgreSQL system runs with the most updated settings without causing any downtime.
Using any method will not interrupt any active queries or connections to the database, thus applying these changes seamlessly.
Tip: If you are making changes to your pg_hba.conf file, see PostgreSQL reload pg_hba.conf without restart.