Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 37A419FB2DA for ; Tue, 10 Oct 2006 13:23:47 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 41647-02 for ; Tue, 10 Oct 2006 13:23:43 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id EFF409FB1E7 for ; Tue, 10 Oct 2006 13:23:42 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k9AGNe3F025405; Tue, 10 Oct 2006 12:23:40 -0400 (EDT) To: Tobias Brox cc: pgsql-performance@postgresql.org Subject: Re: long running transactions In-reply-to: <20061010161027.GA18908@oppetid.no> References: <20061010161027.GA18908@oppetid.no> Comments: In-reply-to Tobias Brox message dated "Tue, 10 Oct 2006 18:10:27 +0200" Date: Tue, 10 Oct 2006 12:23:40 -0400 Message-ID: <25404.1160497420@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.091 tagged_above=0 required=5 tests=AWL, SPF_HELO_PASS, SPF_PASS X-Spam-Level: X-Archive-Number: 200610/192 X-Sequence-Number: 21321 Tobias Brox writes: > If pg_stat_activity.query_start actually is the start time of the > transaction, ... but it isn't. > Is there any way to find the longest running transaction? Look in pg_locks to see the lowest-numbered transaction ID --- each transaction will be holding exclusive lock on its own XID. You can correlate that back to pg_stat_activity via the PID. regards, tom lane