X-Original-To: pgsql-performance@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id C72F8475A71 for ; Tue, 25 Mar 2003 09:37:39 -0500 (EST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 0887B474E44 for ; Tue, 25 Mar 2003 09:37:39 -0500 (EST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.8/8.12.8) with ESMTP id h2PEbfub028391; Tue, 25 Mar 2003 09:37:42 -0500 (EST) To: Andrew Sullivan Cc: pgsql-performance@postgresql.org Subject: Re: Finding the PID keeping a transaction open In-reply-to: <20030325081233.B18817@mail.libertyrms.com> References: <20030325081233.B18817@mail.libertyrms.com> Comments: In-reply-to Andrew Sullivan message dated "Tue, 25 Mar 2003 08:12:34 -0500" Date: Tue, 25 Mar 2003 09:37:41 -0500 Message-ID: <28390.1048603061@sss.pgh.pa.us> From: Tom Lane X-Spam-Status: No, hits=-32.5 required=5.0 tests=BAYES_01,EMAIL_ATTRIBUTION,IN_REP_TO,QUOTED_EMAIL_TEXT, REFERENCES,REPLY_WITH_QUOTES autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200303/173 X-Sequence-Number: 1471 Andrew Sullivan writes: > What I'm trying to figure out is whether there is a way to learn > which pids are responsible for the long-running transaction(s) that > touch(es) the candidate tables. In 7.3 you could look at the pg_locks system view, but I can't think of any reasonable way to do it in 7.2 :-( > I think there must be a way with gdb, but I'm stumped. The lock structures are arcane enough that manual examination with gdb would take many minutes --- which you'd have to do with the LockMgr lock held to keep them from changing underneath you. This seems quite unworkable for a production database ... It's conceivable that some version of the pg_locks code could be back-ported to 7.2 --- you'd have to settle for dumping the info to the log, probably, due to lack of table-function support, but it could be done. regards, tom lane