From 6e2775e4d4e47775f0d933e4a93c148024a3bc63 Mon Sep 17 00:00:00 2001 From: Robert Haas Date: Fri, 20 Jan 2023 15:36:36 -0500 Subject: Add new GUC reserved_connections. This provides a way to reserve connection slots for non-superusers. The slots reserved via the new GUC are available only to users who have the new predefined role pg_use_reserved_connections. superuser_reserved_connections remains as a final reserve in case reserved_connections has been exhausted. Patch by Nathan Bossart. Reviewed by Tushar Ahuja and by me. Discussion: http://postgr.es/m/20230119194601.GA4105788@nathanxps13 --- doc/src/sgml/config.sgml | 39 +++++++++++++++++++++++++++++++++++++-- doc/src/sgml/user-manag.sgml | 5 +++++ 2 files changed, 42 insertions(+), 2 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index e019a1aac99..dc9b78b0b7d 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -708,6 +708,37 @@ include_dir 'conf.d' + + reserved_connections (integer) + + reserved_connections configuration parameter + + + + + Determines the number of connection slots that are + reserved for connections by roles with privileges of the + pg_used_reserved_connections + role. Whenever the number of free connection slots is greater than + but less than or + equal to the sum of superuser_reserved_connections + and reserved_connections, new connections will be + accepted only for superusers and roles with privileges of + pg_use_reserved_connections. If + superuser_reserved_connections or fewer connection + slots are available, new connections will be accepted only for + superusers. + + + + The default value is zero connections. The value must be less than + max_connections minus + superuser_reserved_connections. This parameter can + only be set at server start. + + + + superuser_reserved_connections @@ -725,12 +756,16 @@ include_dir 'conf.d' number of active concurrent connections is at least max_connections minus superuser_reserved_connections, new - connections will be accepted only for superusers. + connections will be accepted only for superusers. The connection slots + reserved by this parameter are intended as final reserve for emergency + use after the slots reserved by + have been exhausted. The default value is three connections. The value must be less - than max_connections. + than max_connections minus + reserved_connections. This parameter can only be set at server start. diff --git a/doc/src/sgml/user-manag.sgml b/doc/src/sgml/user-manag.sgml index 71a2d8f2985..002c1e3affb 100644 --- a/doc/src/sgml/user-manag.sgml +++ b/doc/src/sgml/user-manag.sgml @@ -689,6 +689,11 @@ DROP ROLE doomed_role; and LOCK TABLE on all relations. + + pg_use_reserved_connections + Allow use of connection slots reserved via + . + -- cgit v1.2.3