Thread: wish: limit number of connections per database

wish: limit number of connections per database

From
"bognár, attila"
Date:
Dear List,

I already asked my question on the admin list, but got no answer. As I 
even could not find any related information anywhere, I think my 
question is a wish:

Would it be possible to set the maximum number of connections to each 
database individually? I need this because the server will be shared 
between several users and I want to avoid that that somebody uses the 
maximum number of connections possible to the server, locking out others.

I am not familiar with the internals of postgresql, but maybe a column 
in pg_database could store the limit if any.

A similar solution would be if the number of connections could be 
limited per users, a similar column in pg_user could store the limit.

Or this limit could be configured as an additional column in pg_hba.conf.

How hard would it be to implement such a feature? As there is a check on 
each new connection to the server, maybe it would not be too difficult 
to check one constraint more :-)

I don't have much time to do it, but if you think it is not too hard and 
my limited knowledge in C is enough I would help doing it gladly.

These feature would be good even as a "hidden" feature, configurable 
only through psql after startup (file configuration support added later).

thanks,

attila





Re: wish: limit number of connections per database

From
Oliver Elphick
Date:
On Wed, 2003-09-10 at 20:22, "bognár, attila" wrote:

> Would it be possible to set the maximum number of connections to each
> database individually? I need this because the server will be shared
> between several users and I want to avoid that that somebody uses the
> maximum number of connections possible to the server, locking out others.

I assume users shouldn't be allowed to use other users' databases?

If so, why not have a separate postmaster (and a separate database
cluster) for each user?  Each one would connect on a different port, and
each one could be separately configured.

--
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight, UK                             http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C
========================================   "Draw near to God and he will draw near to you.       Cleanse your hands,
yousinners; and purify your       hearts, you double minded."       James 4:8