// postgresql · connections

reserved_connections

Connection slots kept back for roles granted pg_use_reserved_connections.

默认
0
Range
0 to 262143
Restart needed
是
Default checked on
PostgreSQL 18

作用

Added in PostgreSQL 16 so monitoring or replication-management roles can keep a guaranteed slot without being superusers. Both kinds of reserved slot come out of max_connections: once free slots fall to superuser_reserved_connections + reserved_connections, only superusers and pg_use_reserved_connections members can connect.

默认值

0. 0 (PostgreSQL 18); the parameter exists from PostgreSQL 16.

Check the current value

SHOW reserved_connections;

SELECT setting, unit, boot_val, context, source, pending_restart
FROM pg_settings
WHERE name = 'reserved_connections';

Change it

ALTER SYSTEM SET reserved_connections = 3;
-- 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 a non-superuser monitoring or operations role must always be able to connect.

What can go wrong

Reserved slots are unavailable to the application, so its effective limit drops by this amount.

Questions about reserved_connections

What is the default value of reserved_connections in PostgreSQL?

0. 0 (PostgreSQL 18); the parameter exists from PostgreSQL 16.

Does changing reserved_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 reserved_connections?

When a non-superuser monitoring or operations role must always be able to connect.

Back to all PostgreSQL settings, or check the PostgreSQL manual for every option.

// one client for every engine

Check reserved_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.