Alter System is used to modify the entire server-level configuration by modifying files. Can only be executed by superuser, and cannot be executed in a transaction (modified configuration file, cannot be rolled back)

After configuration, parameters do not take effect immediately. It requires system to reload parameters (pg_reload_conf(), pg_ctl reload, or send SIGHUP to postmaster). Some parameters take effect when server is started. The Restart Server (PG_CTL Restart) is required.


ALTER SYSTEM SET configuration_parameter { TO | = } { value | 'value' | DEFAULT }

ALTER SYSTEM RESET configuration_parameter

Usage example

alter system

ALTER SYSTEM set max_prepared_transactions to 10;

postgres=# show max_prepared_transactions;
(1 row)

[root@centos]# cat /usr/local/pgsql/data/
# Do not edit this file manually!
# It will be overwritten by the ALTER SYSTEM command.
max_prepared_transactions = '10'

A non-startup parameter takes effect and does not require a server restart such as??

select pg_reload_conf();
pg_ctl xxx reload

The startup parameter takes effect and requires a restart of services such as MAX_Prepared_Transactions

pg_ctl xxx restart

Resources for…