pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Scott Marlowe <scott.marlowe@gmail.com>
To: Tena Sakai <tsakai@gallo.ucsf.edu>
Cc: pgsql-admin@postgresql.org
Subject: Re: reading pg_stat_activity view
Date: Thu, 13 Dec 2007 13:47:56 -0600
Message-ID: <dcc563d10712131147h320259bfke93af844a85eefa4@mail.gmail.com> (raw)
In-Reply-To: <FE44E0D7EAD2ED4BB2165071DB8E328C03062E18@egcrc-ex01.egcrc.org>
References: <FE44E0D7EAD2ED4BB2165071DB8E328C03062E18@egcrc-ex01.egcrc.org>

On Dec 13, 2007 1:33 PM, Tena Sakai <tsakai@gallo.ucsf.edu> wrote:
>
> Hi everybody,
>
>  As I look at output from pg_stat_activity view,
>  I see often <idle> under query column and on the
>  same row waiting column is always f.  I gather
>  that this is someone sitting at prompt of psql.
>
>  My question: What does it mean when a query column
>  lists a sql statment and waiting column f?  Would
>  this mean something is in a hung state?

Not what that means at all. :)

It means that the query is not waiting on locks from another query to
be released.  Here's an example you can do yourself to see it happen:

T1: # create table test (a int, b text);
T1: # insert into test values (1,'abc');
T1: # insert into test values (2,'def');
T1: # begin;
T1: # select * from test where a=1 for update;
 a |  b
---+-----
 1 | abc
(1 row)
T2: # update test set b='xyz' where a=1;
(T2 enters a wait state waiting on T1 to commit or rollback)

In another psql session, select * from pg_stat_activity where datname='mydb';
16385 | mydb |   13379 |    16384 | myname | update test set b='xyz'
where a=1;                       | t

Make sense?



view thread (11+ messages)  latest in thread

Message-ID: <dcc563d10712131147h320259bfke93af844a85eefa4@mail.gmail.com>
Permalink:  ../dcc563d10712131147h320259bfke93af844a85eefa4@mail.gmail.com/
Also on:    postgresql.org/message-id/dcc563d10712131147h320259bfke93af844a85eefa4@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: scott.marlowe@gmail.com, tsakai@gallo.ucsf.edu
  Subject: Re: reading pg_stat_activity view
  In-Reply-To: <dcc563d10712131147h320259bfke93af844a85eefa4@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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