From: | Igor Neyman <ineyman(at)perceptron(dot)com> |
---|---|
To: | Si Chen <sichen(at)opensourcestrategies(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: what does pg_activity mean when the database is stuck? |
Date: | 2014-06-12 13:35:36 |
Message-ID: | A76B25F2823E954C9E45E32FA49D70EC7AC56A50@mail.corp.perceptron.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
From: pgsql-general-owner(at)postgresql(dot)org [mailto:pgsql-general-owner(at)postgresql(dot)org] On Behalf Of Si Chen
Sent: Wednesday, June 11, 2014 10:44 PM
To: pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] what does pg_activity mean when the database is stuck?
Is there a way to configure postgresql to automatically release connections that have been idle for a set amount of time?
On Wed, Jun 11, 2014 at 3:41 PM, Merlin Moncure <mmoncure(at)gmail(dot)com> wrote:
On Wed, Jun 11, 2014 at 5:37 PM, Si Chen
<sichen(at)opensourcestrategies(dot)com> wrote:
> The state is "idle". I don't have the state_change, but I will try to
> collect it if it happens again.
If they are idle, then the problem is probably with your application
-- you're grabbing new connections and not closing them or reusing
them. It's a very common problem. The 'query' when idle represents
the last query run -- the database finished it and is sitting around.
merlin
--
Si Chen
Open Source Strategies, Inc.
sichen(at)opensourcestrategies(dot)com
http://www.OpenSourceStrategies.com
LinkedIn: http://www.linkedin.com/in/opentaps
Twitter: http://twitter.com/opentaps
The best solution for this is to use some connection pooler, such as PgBouncer.
B.t.w., PgBouncer can also disconnect idle client connections (if you really wish) based on configuration setting.
Regards,
Igor Neyman
From | Date | Subject | |
---|---|---|---|
Next Message | Christoph Berg | 2014-06-12 13:39:14 | Re: Shared memory changes in 9.4? |
Previous Message | Khangelani Gama | 2014-06-12 10:00:36 | Re: Postgres 9.2.4 - rebuild PostgreSQL using --with-libxml |