Re: When does postgres set the connection state back to idle?

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: "Stephen Sugden" <stephen(at)aers(dot)ca>,<pgsql-admin(at)postgresql(dot)org>
Subject: Re: When does postgres set the connection state back to idle?
Date: 2011-05-11 22:33:33
Message-ID: 4DCAC86D020000250003D5AE@gw.wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Stephen Sugden <stephen(at)aers(dot)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

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Brian Fehrle 2011-05-11 22:54:09 Permission Denied for 'pg_stat_tmp/pgstat.tmp' on Windows server 2003 - postgresql 8.4.6
Previous Message Stephen Sugden 2011-05-11 22:20:11 When does postgres set the connection state back to idle?