Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WdH97-0006TU-Ai for pgsql-bugs@arkaria.postgresql.org; Thu, 24 Apr 2014 10:44:49 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WdH96-0005I3-Hz for pgsql-bugs@arkaria.postgresql.org; Thu, 24 Apr 2014 10:44:48 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WdH95-0005Hv-JA for pgsql-bugs@postgresql.org; Thu, 24 Apr 2014 10:44:47 +0000 Received: from moutng.kundenserver.de ([212.227.126.130]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WdH92-0007sY-FN for pgsql-bugs@postgresql.org; Thu, 24 Apr 2014 10:44:47 +0000 Received: from anarazel.de (p5DDC5375.dip0.t-ipconnect.de [93.220.83.117]) by mrelayeu.kundenserver.de (node=mreue007) with ESMTP (Nemesis) id 0LqrbD-1X8m8f3uFf-00eaRu; Thu, 24 Apr 2014 12:44:43 +0200 Received: by anarazel.de (Postfix, from userid 1000) id 359CF100567; Thu, 24 Apr 2014 12:44:42 +0200 (CEST) Date: Thu, 24 Apr 2014 12:44:42 +0200 From: Andres Freund To: Magnus Hagander Cc: maxim.boguk@gmail.com, pgsql-bugs Subject: Re: BUG #10123: Weird entries in pg_stat_activity Message-ID: <20140424104442.GC16111@awork2.anarazel.de> References: <20140424101827.2714.39486@wrigleys.postgresql.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Provags-ID: V02:K0:rckEJhThHdQfxQbOOIrydNBLlcfcEHf8I143TEAyL2E QN2TZMPXP6C84VMjdhfe3wkyoLtV4SYUsHgvRnHuSP3fmOC/OT IP3Bmhao0bWzeVmQCGylmo55Sva2i4fMI2WkPnVkb7nG535fuK i0iOlYu9da7uFYgzfWu9izv83pK4iOzSQHWONnT+rmZDdkbaAh SHIhVMK/BZMVWD/qYio9qInud8ukGYKXJXMR9gDSIl+nxWmvgr VGiaCz6LJCwlUSdGPOyr1RWLd/FB/Vhh4jKk15jA2T0ihTMJDO OvBzEFrNJ621gZc1ylv8Q+05EgluPu20t3K8LlwIopN7WpbKv1 ZuqJnKG9YuVB2VkLUC7ewBiw6u2C8+ZgoUln0VY0k 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:26:09 +0200, Magnus Hagander wrote: > On Thu, Apr 24, 2014 at 12:18 PM, wrote: > > ]----+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- > > ts | 2014-04-24 13:49:03.498354+04 > > tx_age | 00:04:01.283106 > > change_age | 00:04:01.279373 > > datid | 16385 > > datname | ******* > > pid | 685 > > usesysid | 16384 > > usename | ******* > > application_name | > > client_addr | 127.0.0.1 > > client_hostname | > > client_port | 37461 > > backend_start | 2014-04-24 13:30:03.275711+04 > > xact_start | 2014-04-24 13:45:02.215248+04 > > query_start | 2014-04-24 13:45:02.215248+04 > > state_change | 2014-04-24 13:45:02.218981+04 > > waiting | f > > state | idle > > query | > > | SELECT cache.save_response( > > | ***** > > | ); > This sounds like the expected behavior. When state=Idle, the query field > shows the value of the *last* query that ran. See > http://www.postgresql.org/docs/9.3/static/monitoring-stats.html#PG-STAT-ACTIVITY-VIEW > . > > Note that this was changed in 9.2, and at the same time the current_query > field was renamed to query to highlight this change. > > The fact that xact_start shows something far in the past just means that > there is an open transaction that has been open since then. I don't think that's true. In that case the state should have been idle in transaction, no? 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? 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