Configuration·PostgreSQL
PostgreSQL ALTER SYSTEM and postgresql.auto.conf
SET lasts one session, ALTER SYSTEM writes a file the server owns. Between them they cover every durable change without ever editing a config file by hand.
Configuration Guide 13 of 47 Intermediate
- OSUbuntu 26.04 LTS
- PostgreSQL18.6-0ubuntu0.26.04.1
- TimeAbout 14 min
postgresql.auto.conf is read last, so it overrides every other file. That makes it powerful and makes it the first place to look when a config file appears to be ignored.
- PackagingDebian cluster layout
| Server Name | IP Address | OS | Roles | CPU | RAM | HDD |
|---|---|---|---|---|---|---|
| db-a01 | 192.168.0.81 | Ubuntu 26.04 LTS | Primary / Source / Replica Set Member 1 | 2 Core | 4 GB | 50 GB |
This guide includes
Use this when a setting has to outlive the session that set it. This matters because SET lasts one connection while ALTER SYSTEM writes a file the server owns - and it is SQL, so it needs no shell access to the host at all.
- changing a setting for one session only, and confirming it with
SHOW - making a change the server records for you, with
ALTER SYSTEM - seeing that it is SQL, so no shell access to the machine is required
Before you start
- A superuser connection -
sudo -u postgres psql.
-
Change a setting for one session only
-
Make a change the server records for you