pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
When does postgres set the connection state back to idle?
2+ messages / 2 participants
[nested] [flat]

* When does postgres set the connection state back to idle?
@ 2011-05-11 22:20  Stephen Sugden <stephen@aers.ca>
  0 siblings, 1 reply; 2+ messages in thread

From: Stephen Sugden @ 2011-05-11 22:20 UTC (permalink / raw)
  To: pgsql-admin

I've been having a difficult time finding an answer for this via google, so
please excuse me if this is the wrong list, or a stupid question...

We're trying to diagnose a system issue where we ended up with 100's of
non-idle queries in pg_stat_activity, but the actual system load didn't
correspond to what we should have seen with that query load. Is it possible
that a client could cause this by not acknowledging that it has received
results, so that postgres will think the query is active even when it's done
the hard work of getting the queried data off disk? These were all SELECT
queries if that makes any difference.

-Stephen

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: When does postgres set the connection state back to idle?
@ 2011-05-11 22:33  Kevin Grittner <Kevin.Grittner@wicourts.gov>
  parent: Stephen Sugden <stephen@aers.ca>
  0 siblings, 0 replies; 2+ messages in thread

From: Kevin Grittner @ 2011-05-11 22:33 UTC (permalink / raw)
  To: Stephen Sugden <stephen@aers.ca>; pgsql-admin

Stephen Sugden <stephen@aers.ca> wrote:
 
> We're trying to diagnose a system issue where we ended up with
> 100's of non-idle queries in pg_stat_activity, but the actual
> system load didn't correspond to what we should have seen with
> that query load. Is it possible that a client could cause this by
> not acknowledging that it has received results, so that postgres
> will think the query is active even when it's done the hard work
> of getting the queried data off disk? These were all SELECT
> queries if that makes any difference.
 
You need to look at pg_stat_activity and pg_locks.  Look for
processes that have waiting true, and locks that have granted false.
There are queries on the Wiki to help sort it out.
 
http://wiki.postgresql.org/wiki/Lock_Monitoring
 
http://wiki.postgresql.org/wiki/Lock_dependency_information
 
By the way, it sounds like you should seriously consider using a
connection pooler.
 
-Kevin



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2011-05-11 22:33 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-05-11 22:20 When does postgres set the connection state back to idle? Stephen Sugden <stephen@aers.ca>
2011-05-11 22:33 ` Kevin Grittner <Kevin.Grittner@wicourts.gov>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox