Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id E4F392E2DD7 for ; Thu, 13 Dec 2007 15:48:02 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 24203-10 for ; Thu, 13 Dec 2007 15:47:58 -0400 (AST) Received: from wa-out-1112.google.com (wa-out-1112.google.com [209.85.146.176]) by postgresql.org (Postfix) with ESMTP id 786B82E2DB4 for ; Thu, 13 Dec 2007 15:47:58 -0400 (AST) Received: by wa-out-1112.google.com with SMTP id m38so1332540waf.5 for ; Thu, 13 Dec 2007 11:47:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=Ed8O7TCtLsUhDQSNS+GoQmpMC/Yz6L6Akfmh8/S2ffA=; b=GJ8zVUI7frYCa4mADoSpsM3oEghIMqH+/PQjVAFxnxlRhL0+f1JKiWRouSNeai3Ve85zimRJ5+fXXY5P/qJGNE6HSm8B+SXkIcOfnfr+Ad9pC3UYEN2QKcZ/H4LOH8V32K6czmS48BBHgnmDFxs1NJ1JK2tCO0dXx3NJh58sIxU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=bAvo+RRq/L/lzhJyCRrw8sWN+LMlMMPrBhRn2a7aN96PqGt7UZoagWQA86Pcn/BEPd9bimbBZ94Q6zs8iwki1Z0/JYFoUd2zQpVV0WuoIM69hTRs0lfxl77v44QA0/vXWMYUtDJAPgzQkw4rNqJbg4udCoaSXdZkkCJcgQhodQo= Received: by 10.114.93.17 with SMTP id q17mr2698603wab.70.1197575276837; Thu, 13 Dec 2007 11:47:56 -0800 (PST) Received: by 10.114.131.4 with HTTP; Thu, 13 Dec 2007 11:47:56 -0800 (PST) Message-ID: Date: Thu, 13 Dec 2007 13:47:56 -0600 From: "Scott Marlowe" To: "Tena Sakai" Subject: Re: reading pg_stat_activity view Cc: pgsql-admin@postgresql.org In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200712/93 X-Sequence-Number: 27610 On Dec 13, 2007 1:33 PM, Tena Sakai wrote: > > Hi everybody, > > As I look at output from pg_stat_activity view, > I see often 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?