From: | Phil Frost <phil(at)postmates(dot)com> |
---|---|
To: | pgsql-admin <pgsql-admin(at)postgresql(dot)org> |
Subject: | Re: pg_stat_activity doubts |
Date: | 2018-03-22 14:14:40 |
Message-ID: | CAC6ry0LFHv+eMjpde_3jqfSnG9hg2O6s=9VTwLh2jiYydXSqGg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
On Thu, Mar 22, 2018 at 8:46 AM Debraj Manna <subharaj(dot)manna(at)gmail(dot)com>
wrote:
>
> 1. Can some let me know what does the state IDLE denotes in the row of
> pg_stat_activity? Is it like it checks all the open connections to
> postgres and if the connection is not executing any query then IDLE denotes
> the last query executed by the connection?
> 2. In the output of select * from pg_stat_activity I am seeing rows
> with state IDLE and the query_start_date more than 2 days old? What
> does this signify ? Should I be worried about this?
>
>
Each row in pg_stat_activity represents an established connection to the
server from a client. "idle" means the client is not currently executing a
query nor in a transaction.
If query_start_date is 2 days old, that just means the last query to be
executed on that connection was two days ago.
Not really a reason for worry, unless you have so many connections open
that it's consuming more RAM than you can afford. It's generally desirable
for a connection pool to have a few idle connections so queries don't
suffer the latency of establishing a new connection.
From | Date | Subject | |
---|---|---|---|
Next Message | Ray Stell | 2018-03-22 14:16:34 | Re: pg_stat_activity doubts |
Previous Message | Bear Giles | 2018-03-22 14:03:30 | Re: postgres encryption |