Bruce Momjian <pgman@candle.pha.pa.us> writes:
>> Well, there are two different things here. I agree that if an app
>> is going to use persistent connections, it should be the app's
>> responsibility to manage them. But a per-database, as opposed to
>> installation-wide, limit on number of connections seems like a
>> reasonable idea. Note that the limit would result in new connections
>> being rejected, not old ones being summarily cut.
> But then the app is going to keep trying to connect over and over unless
> it knows something about why it can't connect.
So? If it hits the installation-wide limit, you'll have the same
problem; and at that point the (presumably runaway) app would have
sucked up all the connections, denying service to other apps using other
databases. I think Marc's point here is to limit his exposure to
misbehavior of any one client app, in a database server that is serving
multiple clients using multiple databases.
It occurs to me that a per-user connection limit is going to be the next
thing he asks for ;-). We could implement that too, if we wanted.
(Not sure whether PGPROC stores the user id, but it easily could.)
regards, tom lane