X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 48A91D1B1CB for ; Mon, 5 Jul 2004 23:28:46 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 36739-03 for ; Tue, 6 Jul 2004 02:28:41 +0000 (GMT) Received: from candle.pha.pa.us (candle.pha.pa.us [207.106.42.251]) by svr1.postgresql.org (Postfix) with ESMTP id 3174ED1B19C for ; Mon, 5 Jul 2004 23:28:35 -0300 (ADT) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id i662REq15694; Mon, 5 Jul 2004 22:27:14 -0400 (EDT) From: Bruce Momjian Message-Id: <200407060227.i662REq15694@candle.pha.pa.us> Subject: Re: How to list what queries are running in postgres? In-Reply-To: <3246.1088566642@sss.pgh.pa.us> To: Tom Lane Date: Mon, 5 Jul 2004 22:27:13 -0400 (EDT) Cc: Gaetano Mendola , "P.A.M. van Dam" , pgsql-admin@postgresql.org X-Mailer: ELM [version 2.4ME+ PL108 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200407/65 X-Sequence-Number: 14133 Tom Lane wrote: > Gaetano Mendola writes: > > P.A.M. van Dam wrote: > >> I'm looking for a command or method to find out what queries are > >> currently being serviced by the database. > > > select * from pg_stat_activity; > > ... having first remembered to turn on stats_command_string; and > thou shalt also be superuser. And 7.5 will print out a more helpful message if you forget to set these: test=> select * from pg_stat_activity; datid | datname | procpid | usesysid | usename | current_query | query_start -------+---------+---------+----------+----------+------------------------------+------------- 17227 | test | 15527 | 100 | guest | | 17227 | test | 15574 | 1 | postgres | | (2 rows) -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073