Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WdNjX-0001xy-2A for pgsql-bugs@arkaria.postgresql.org; Thu, 24 Apr 2014 17:46:51 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WdNjW-0003QN-HK for pgsql-bugs@arkaria.postgresql.org; Thu, 24 Apr 2014 17:46:50 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WdNjU-0003Oa-SW for pgsql-bugs@postgresql.org; Thu, 24 Apr 2014 17:46:49 +0000 Received: from moutng.kundenserver.de ([212.227.126.187]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WdNjR-0000DU-Q5 for pgsql-bugs@postgresql.org; Thu, 24 Apr 2014 17:46:48 +0000 Received: from anarazel.de (p5DDC5375.dip0.t-ipconnect.de [93.220.83.117]) by mrelayeu.kundenserver.de (node=mreue005) with ESMTP (Nemesis) id 0LyyQu-1WzVAI1mTo-014Bp3; Thu, 24 Apr 2014 19:46:42 +0200 Received: by anarazel.de (Postfix, from userid 1000) id BD3CA100567; Thu, 24 Apr 2014 19:46:41 +0200 (CEST) Date: Thu, 24 Apr 2014 19:46:41 +0200 From: Andres Freund To: Tom Lane Cc: Magnus Hagander , maxim.boguk@gmail.com, pgsql-bugs Subject: Re: BUG #10123: Weird entries in pg_stat_activity Message-ID: <20140424174641.GC32057@awork2.anarazel.de> References: <20140424101827.2714.39486@wrigleys.postgresql.org> <20140424104442.GC16111@awork2.anarazel.de> <474.1398357435@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <474.1398357435@sss.pgh.pa.us> X-Provags-ID: V02:K0:WmcgNOLHSkZNoVuzzLfhf1Cwctc1BdybCZA4LNGgohW kCzxFZ10C5RWTtrFxprT86Q0saq/p1eduzLMLGfwdMMOkDDMGS Sa1GMb/h9OtSPtZ1sPadYvztd/LGgJq79bhs+mQnbM6Ugl2URy fuscsRRPi8u7T9KbjTRguGCJBtOOwXhkQzHLXbOBHY6yS/T3Gp F+sUV7s+Qm1MnAs/h1bqC1kYCsYCV7i1PNmQRkgUI0KTclBeUC DlYHtOKeVFpCq9ri+rfx6tMvsK8DBCD/2fdMo/XDAZhMZWAiId K0OjHIIOgDw6r2fsDw5Z5JOmUCP1QJh4RS0y3FZvNW+j9mM0j2 0TuqHIR4xjyAIEd9HuRKmOXXnQ2EhIbbbI+jwSZeO X-Pg-Spam-Score: -1.9 (-) 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 On 2014-04-24 12:37:15 -0400, Tom Lane wrote: > 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? Right. I think there's some other contents that could potentially end up there, but surely not the SELECT Maxim is reporting. Especially not as there seem to be several minutes inbetween the pg_stat_get_activity call and the last state change... > 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. Thanks for fixing it. I don't really have a clue what's going on here. I don't believe pgstat.c's changecount thing is 100% safe, but that doesn't explain the problem here. Greetings, Andres Freund -- Andres Freund http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs