Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mwl3g-0006HH-TE for pgsql-admin@arkaria.postgresql.org; Mon, 13 Dec 2021 13:08:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mwl3f-000618-Pw for pgsql-admin@arkaria.postgresql.org; Mon, 13 Dec 2021 13:07:59 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mwl3f-0005pi-Gy for pgsql-admin@lists.postgresql.org; Mon, 13 Dec 2021 13:07:59 +0000 Received: from mout.perfora.net ([74.208.4.197]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mwl3a-00074P-Gl for pgsql-admin@lists.postgresql.org; Mon, 13 Dec 2021 13:07:59 +0000 Received: from [192.168.1.167] ([98.169.214.209]) by mrelay.perfora.net (mreueus002 [74.208.5.2]) with ESMTPSA (Nemesis) id 0MFNDu-1miVRc2sxY-00EKVY; Mon, 13 Dec 2021 14:07:36 +0100 Subject: Re: [EXTERNAL] Re: Limits user connection in pgbouncer To: "Godfrin, Philippe E" Cc: Achilleas Mantzios , "pgsql-admin@lists.postgresql.org" References: <3f48f38a-c3f5-205b-1d4f-6e561417272e@matrix.gatewaynet.com> From: MichaelDBA Message-ID: <1da96539-bdef-4158-1e38-fa95371c464e@sqlexec.com> Date: Mon, 13 Dec 2021 08:07:32 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 PostboxApp/7.0.53 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------6B04424E92B42C06E98CE075" Content-Language: en-US X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: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------6B04424E92B42C06E98CE075 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Hi all, If you add the user to the database specification, then you can limit connections per user: db1 = host=localhost dbname=db1 pool_size=2 user=myuser Regards, Michael Vitale Godfrin, Philippe E wrote on 12/13/2021 7:57 AM: > On 13/12/21 10:05 π.μ., Daulat wrote: >> Hello Team, >> How can we limit the user to  make a specific number of connections >> to the database? > Just specify this in the db definition configuration : > > db1 = host=localhost dbname=db1 pool_size=2 > > but it will apply to every user, so that every user's pool will have > max 2 connections, not only user1. > > Alternatively you could set "ALTER ROLE .. CONNECTION LIMIT connlimit > " for user1 individually. --------------6B04424E92B42C06E98CE075 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit Hi all,

If you add the user to the database specification, then you can limit connections per user:
db1 = host=localhost dbname=db1 pool_size=2 user=myuser

Regards,
Michael Vitale


Godfrin, Philippe E wrote on 12/13/2021 7:57 AM:
On 13/12/21 10:05 π.μ., Daulat wrote:
Hello Team,
How can we limit the user to  make a specific number of connections to the database?
Just specify this in the db definition configuration :

db1 = host=localhost dbname=db1 pool_size=2

but it will apply to every user, so that every user's pool will have max 2 connections, not only user1.

Alternatively you could set "ALTER ROLE .. CONNECTION LIMIT connlimit " for user1 individually.

--------------6B04424E92B42C06E98CE075--