X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 71C969FA372 for ; Tue, 23 May 2006 18:47:45 -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 50291-03 for ; Tue, 23 May 2006 18:47:35 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.188]) by postgresql.org (Postfix) with ESMTP id 09C879FA169 for ; Tue, 23 May 2006 18:47:34 -0300 (ADT) Received: from [195.112.19.37] (helo=[192.168.0.7]) by mrelayeu.kundenserver.de (node=mrelayeu4) with ESMTP (Nemesis), id 0ML21M-1Fieir3Oun-0003gc; Tue, 23 May 2006 23:47:27 +0200 Subject: Re: Selects query stats? From: Simon Riggs To: Tom Lane Cc: Alvaro Herrera , "Jim C. Nasby" , Dan Gorman , mischa@ca.sophos.com, pgsql-performance@postgresql.org In-Reply-To: <19283.1148414150@sss.pgh.pa.us> References: <9C4E40CF-6C06-4297-AF32-A7EF2A3F3C0F@hi5.com> <4473512E.7020805@ca.sophos.com> <82252882-2A15-4823-A517-7AB3161889D1@hi5.com> <4473553C.1010804@ca.sophos.com> <127D68F6-7620-4A62-8D1A-9B475E7571CD@hi5.com> <20060523184100.GW64371@pervasive.com> <17713.1148411593@sss.pgh.pa.us> <20060523195001.GH28863@surnet.cl> <19283.1148414150@sss.pgh.pa.us> Content-Type: text/plain Date: Tue, 23 May 2006 22:47:16 +0100 Message-Id: <1148420837.2755.196.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.6.1 (2.6.1-1.fc5.2) Content-Transfer-Encoding: 7bit X-Provags-ID: kundenserver.de abuse@kundenserver.de login:726643fe08f41a451f0fe7fa43bce239 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200605/442 X-Sequence-Number: 19229 On Tue, 2006-05-23 at 15:55 -0400, Tom Lane wrote: > Alvaro Herrera writes: > > OTOH ISTM it would be easy to modify Postgres so as to count statements > > in the stat collector, by turning pgstat_report_activity into a routine > > that sent a count (presumably always 1) instead of the query string, and > > then just add the count to a counter on receiving. > > You wouldn't have to change the backends at all, just modify the > collector to count the number of report_activity messages received. > Might have to play some games with ignoring "" messages, but > otherwise simple (and simplistic...) The OP wanted statements/sec rather than just a total. Having stats logged by time would be very useful, but I wouldn't limit that just to numbers of statements in each time period. stats_logging_interval = 60 by default, 0 to disable, range 5-3600 -- Simon Riggs EnterpriseDB http://www.enterprisedb.com