Re: i can't connect after some periode

From: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
To: lennin(dot)caro(at)yahoo(dot)com
Cc: pgsql-sql(at)postgresql(dot)org, aldy <aldy(at)teodore(dot)com>
Subject: Re: i can't connect after some periode
Date: 2008-07-10 14:48:20
Message-ID: dcc563d10807100748q6a16cd09q125244322713a985@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Thu, Jul 10, 2008 at 8:22 AM, Lennin Caro <lennin(dot)caro(at)yahoo(dot)com> wrote:
>
>
>
> --- On Thu, 7/10/08, aldy <aldy(at)teodore(dot)com> wrote:
>
>> From: aldy <aldy(at)teodore(dot)com>
>> Subject: Re: [SQL] i can't connect after some periode
>> To: pgsql-sql(at)postgresql(dot)org
>> Date: Thursday, July 10, 2008, 8:16 AM
>> From: "A. Kretschmer"
>> <andreas(dot)kretschmer(at)schollglas(dot)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.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Chris Preston 2008-07-10 15:40:17 Converting Copy to insert statement in backup file
Previous Message Lennin Caro 2008-07-10 14:22:41 Re: i can't connect after some periode