On Thu, Jul 10, 2008 at 8:22 AM, Lennin Caro <lennin.caro@yahoo.com> wrote:
>
>
>
> --- On Thu, 7/10/08, aldy <aldy@teodore.com> wrote:
>
>> From: aldy <aldy@teodore.com>
>> Subject: Re: [SQL] i can't connect after some periode
>> To: pgsql-sql@postgresql.org
>> Date: Thursday, July 10, 2008, 8:16 AM
>> From: "A. Kretschmer"
>> <andreas.kretschmer@schollglas.com>
>> Sent: Thursday, July 10, 2008 14:14
>>
>>
>> >First, don't hijack other threads, your mail
>> contains a
>> >References-header:
>>
>> owkay, i'm sorry for that
>>
>> > Maybe the clients do not close the connection and
>> after some time you
>> > have more than 'max_connections' (Default
>> 100).
>> >
>> > You can increase this value in your postgresql.conf.
>> >
>> >
>> > You can also check, how many active connections are
>> open with 'select *
>> > from pg_stat_activity'.
>> >
>> >
>> > Hope that helps, Andreas
>>
>> thanks for the answer,
>> is there any procedure(utility) or configuration in
>> postgresql which can
>> auto close for connection that idle for some minutes
>>
> config parameters in postgres.conf
>
> tcp_keepalives_idle (integer)
> tcp_keepalives_interval (integer)
> tcp_keepalives_count (integer)
Note that if the client is still up and running, then this will not
close the connection. However, if a firewall between client and
server is dropping idle connections then this will harvest them.
There is no built in functionality to disconnect idle connections that
are still alive. You'd have to write some sort of shell script to
find them and send them a SIGTERM signal (is that the right signal? I
always forget which signal is the right one. Could be SIGHUP or
SIGQUIT too.
A better option might be to look into pgpool, which can allow you to
keep your db connections down while having a large number of fairly
cheap connections kept open on the client side.