Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id B5056633371 for ; Thu, 26 Mar 2009 08:01:10 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 88032-08 for ; Thu, 26 Mar 2009 08:00:31 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from serv2.oss.ntt.co.jp (serv2.oss.ntt.co.jp [222.151.198.100]) by mail.postgresql.org (Postfix) with ESMTP id 09E426348E4 for ; Thu, 26 Mar 2009 08:00:18 -0300 (ADT) Received: from serv2.oss.ntt.co.jp (localhost [127.0.0.1]) by serv2.oss.ntt.co.jp (Postfix) with ESMTP id 6A0082480D6; Thu, 26 Mar 2009 20:00:13 +0900 (JST) Received: from serv1.oss.ntt.co.jp (serv1.localdomain [172.19.0.2]) by serv2.oss.ntt.co.jp (Postfix) with ESMTP id 56B582480D1; Thu, 26 Mar 2009 20:00:13 +0900 (JST) Received: from [127.0.0.1] (unknown [172.17.1.145]) by serv1.oss.ntt.co.jp (Postfix) with ESMTP id 1DC62104165; Thu, 26 Mar 2009 20:00:13 +0900 (JST) Message-ID: <49CB6039.9060306@oss.ntt.co.jp> Date: Thu, 26 Mar 2009 20:00:09 +0900 From: Tatsuhito Kasahara User-Agent: Thunderbird 1.5.0.9 (Windows/20061207) MIME-Version: 1.0 To: ITAGAKI Takahiro CC: Guillaume Smet , depesz@depesz.com, pgsql-hackers@postgresql.org Subject: Re: display previous query string of idle-in-transaction References: <1d4e0c10903251007v500e762bqd3514a0c440b928c@mail.gmail.com> <49CB39C7.2000008@oss.ntt.co.jp> <20090326175406.AC8E.52131E4D@oss.ntt.co.jp> In-Reply-To: <20090326175406.AC8E.52131E4D@oss.ntt.co.jp> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200903/1041 X-Sequence-Number: 135719 ITAGAKI Takahiro wrote: > The feature could be achieved by an extension module using new executor > hooks in 8.4. It is just like contrib/pg_stat_statements; Well, it is a good idea. Displaying last-query-string may be useful, but it is not a feature for general purpose. So, it may be an external module. Now, I have two choice. 1. Displaying last-query-string by pg_stat_activity (suggested by Gurjeet): Extends the pg_stat_activity to display "previous_query". We can check only a previous query. 2. Displaying query-string-history by external module (suggested by Itagaki): Using executor hook to get a query string and stores it in shared memory. We can check specified number of query string history. I think I will try mainly 2. # Or this feature may merge to pg_stat_statements. Any comments welcome. Best regards, -- Tatsuhito Kasahara kasahara.tatsuhito@oss.ntt.co.jp