max_connections
Maximum number of concurrent client connections.
- Standard
100- Range
- 1 to 262143
- Restart needed
- Ja
- Default checked on
- PostgreSQL 18
Was es bewirkt
Each connection is a separate backend process with its own memory, and several shared structures (lock table, snapshot arrays) are sized from this number at startup.
Standardwert
100. 100 (PostgreSQL 18); initdb lowers it if the machine cannot support 100. The Docker image writes 100.
Check the current value
SHOW max_connections; SELECT setting, unit, boot_val, context, source, pending_restart FROM pg_settings WHERE name = 'max_connections';
Change it
ALTER SYSTEM SET max_connections = 200; -- applies only after a server restart
Server restart required (pg_settings.context is postmaster). ALTER SYSTEM only stages the new value in postgresql.auto.conf.
When to change it
When applications legitimately need more sessions. If the count comes from many idle pooled connections, put PgBouncer or the app's pool in front instead; a few hundred active backends is already a lot.
What can go wrong
Every slot costs memory even when idle, and many active backends contend for locks and CPU. Standbys must have max_connections at least as high as the primary.
The closest setting on other engines
| Engine | Einstellung | Standard | Restart |
|---|---|---|---|
| PostgreSQL |
max_connections this page
|
100 |
Ja |
| MySQL |
max_connections
|
151 |
Nein |
| SQL Server |
user connections
|
0 (= 32767) |
Ja |
| Oracle |
processes
|
Set at creation |
Ja |
Questions about max_connections
What is the default value of max_connections in PostgreSQL?
100. 100 (PostgreSQL 18); initdb lowers it if the machine cannot support 100. The Docker image writes 100.
Does changing max_connections require a restart?
Yes. Server restart required (pg_settings.context is postmaster). ALTER SYSTEM only stages the new value in postgresql.auto.conf.
When should I change max_connections?
When applications legitimately need more sessions. If the count comes from many idle pooled connections, put PgBouncer or the app's pool in front instead; a few hundred active backends is already a lot.
Back to all PostgreSQL settings, or check the PostgreSQL manual for every option.
Check max_connections on your own server
SQLly runs the query above against PostgreSQL and the other engines in this reference, from one desktop app on macOS, Windows and Linux.