X-Original-To: pgsql-admin-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id D23509FA6B1 for ; Tue, 25 Jul 2006 07:26:14 -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 29926-07-2 for ; Tue, 25 Jul 2006 07:26:07 -0300 (ADT) X-Greylist: delayed 00:21:45.780429 by SQLgrey- Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 4F3C19FAA6E for ; Tue, 25 Jul 2006 06:59:40 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 Received: from smtpgw.computec.de (smtpgw.computec.de [212.123.108.8]) by svr4.postgresql.org (Postfix) with ESMTP id 41DCF5AFB4F for ; Tue, 25 Jul 2006 09:37:53 +0000 (GMT) Received: from localhost (localhost.localdomain [127.0.0.1]) by smtpgw.computec.de (Postfix) with ESMTP id E6B6D2EC1C for ; Tue, 25 Jul 2006 11:37:48 +0200 (CEST) Received: from smtpgw.computec.de ([127.0.0.1]) by localhost (localhost [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 15910-01-25 for ; Tue, 25 Jul 2006 11:37:48 +0200 (CEST) Received: from HERMES.computec.de (unknown [192.168.0.22]) by smtpgw.computec.de (Postfix) with ESMTP id 8B5252EBAA for ; Tue, 25 Jul 2006 11:37:48 +0200 (CEST) X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Re: Checking what is the current query running Date: Tue, 25 Jul 2006 11:34:28 +0200 Message-ID: <28011CD60FB1724DBA4442E38277F62601C95103@hermes.computec.de> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [ADMIN] Checking what is the current query running thread-index: AcavyxiC669EcT8cSTS3c/9m2Z/uJgAAEJBw From: "Markus Wollny" To: "Postgres" X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at computec.de X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200607/200 X-Sequence-Number: 22446 Hi, pg_stat_activity has some limitations however; if you use a lot of dynamically generated complex queries, you might stumble over the 255 character limit of current_query in pg_stat_activity, statement-strings longer than that are just cut off. You can get some more information if you need it, using the GNU debugger gdb: First you need to determine the PID of the PostgreSQL backend that's running your query - I usually use top for that, but pg_stat_activity does also give you that info (select procpid from pg_stat_activity ...). Once you have the PID, you start the GNU debugger with gdb [path_to_postgres] [pid] e.g. gdb /opt/pgsql/bin/postgres 551 Now issue the command=20 printf "%s\n", debug_query_string to obtain the query string. To quit the debugger, just type "quit" and confirm - the backend will keep processing the query uninterrupted. Kind regards Markus