From: | Craig Ringer <ringerc(at)ringerc(dot)id(dot)au> |
---|---|
To: | JD Wong <jdmswong(at)gmail(dot)com> |
Cc: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: IDLE queries taking up space |
Date: | 2011-08-31 01:16:22 |
Message-ID: | 4E5D8B66.7060608@ringerc.id.au |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 31/08/2011 12:03 AM, JD Wong wrote:
> Hi,
>
> When I run select datname, procpid, current_query from
> pg_stat_activity; I get 26 rows of <IDLE> queries. How can I set
> postgres to qutomatically close connections that have finished their
> queries and now sit idle?
If they're not idle in transaction, they don't matter much.
Try filtering the list based on last activity, so you only see those
connections that have been idle for a while. Short periods of idle are
normal for many applications because they perform a query then process
its results and issue other queries based on the results, or because
they keep a connection around between requests from users.
If the idle connections are actually causing an issue - for example, if
they're preventing the release of non-trivial amounts of backend private
memory back to the OS - you can tweak the client to disconnect after a
certain idle time, or you can use a connection pool. Connection pools
may be inside the client (for example, in Java EE application servers)
or between the client and the server using tools like pgbouncer and
PgPool-II.
--
Craig Ringer
From | Date | Subject | |
---|---|---|---|
Next Message | Rich Shepard | 2011-08-31 01:16:39 | Re: COPY failure on directory I own |
Previous Message | Craig Ringer | 2011-08-31 00:44:35 | Re: COPY failure on directory I own |