TIL 20250228

Today I learnt that ALTER SYSTEM SET max_connections = 100; writes a new configuration file in the data directory for PostgreSQL, postgresql.auto.conf which takes priority over the values in the normal postgresql.config file.

It's especially pointless to use ALTER SYSTEM for max_connections because you need to restart PostgreSQL anyway, as it allocates memory for the connections at start up. You gain nothing by having this configuration tucked away in a separate configuration file - might as well change the standard configuration file, then restart.