Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WdMeK-0007yu-TY for pgsql-bugs@arkaria.postgresql.org; Thu, 24 Apr 2014 16:37:25 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WdMeK-0008GN-Dz for pgsql-bugs@arkaria.postgresql.org; Thu, 24 Apr 2014 16:37:24 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WdMeJ-0008GH-Mq for pgsql-bugs@postgresql.org; Thu, 24 Apr 2014 16:37:23 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WdMeH-0007OU-9W for pgsql-bugs@postgresql.org; Thu, 24 Apr 2014 16:37:23 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id s3OGbFoA000475; Thu, 24 Apr 2014 12:37:15 -0400 From: Tom Lane To: Andres Freund cc: Magnus Hagander , maxim.boguk@gmail.com, pgsql-bugs Subject: Re: BUG #10123: Weird entries in pg_stat_activity In-reply-to: <20140424104442.GC16111@awork2.anarazel.de> References: <20140424101827.2714.39486@wrigleys.postgresql.org> <20140424104442.GC16111@awork2.anarazel.de> Comments: In-reply-to Andres Freund message dated "Thu, 24 Apr 2014 12:44:42 +0200" Date: Thu, 24 Apr 2014 12:37:15 -0400 Message-ID: <474.1398357435@sss.pgh.pa.us> X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Andres Freund writes: > I think there's a pgstat_report_xact_timestamp(0) missing from > xact.c:PrepareTransaction(). There's no point in reporting a prepared > xact's starttime in a backend that's not associated with it anymore. > Maxim, are you using prepared transactions? Even if he were, that wouldn't explain this report, because the displayed latest-query would have to have been a PREPARE TRANSACTION, no? However, regardless of exactly what's going on here, I think you're probably right that PrepareTransaction ought to do pgstat_report_xact_timestamp(0) once it exits the transaction state locally. The definition of that field is that it's null whenever the session isn't inside a transaction, and once we do PREPARE, we aren't. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs