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 D99F99FA372 for ; Tue, 23 May 2006 16:50:44 -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 36392-02 for ; Tue, 23 May 2006 16:50:17 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from alvh.no-ip.org (201-221-200-231.bk11-dsl.surnet.cl [201.221.200.231]) by postgresql.org (Postfix) with ESMTP id 8E2DF9FA169 for ; Tue, 23 May 2006 16:50:15 -0300 (ADT) Received: by alvh.no-ip.org (Postfix, from userid 1000) id CE24FC3737F; Tue, 23 May 2006 15:50:01 -0400 (CLT) Date: Tue, 23 May 2006 15:50:01 -0400 From: Alvaro Herrera To: Tom Lane Cc: "Jim C. Nasby" , Dan Gorman , mischa@ca.sophos.com, pgsql-performance@postgresql.org Subject: Re: Selects query stats? Message-ID: <20060523195001.GH28863@surnet.cl> Mail-Followup-To: Tom Lane , "Jim C. Nasby" , Dan Gorman , mischa@ca.sophos.com, pgsql-performance@postgresql.org 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <17713.1148411593@sss.pgh.pa.us> User-Agent: Mutt/1.5.11+cvs20060403 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200605/438 X-Sequence-Number: 19225 Tom Lane wrote: > Counting individual statements would add overhead (which the OP already > declared unacceptable) and there are some definitional issues too, like > whether to count statements executed within functions. Yeah, the problem seems underspecified. How do you count statements added or removed by rewrite rules? Statements executed to answer RI queries? Do you count the statements issued by clients as part of the startup sequence? The hypothetical "reset session" of a connection pool handler? How do you count 2PC -- when they are executed, or when they are committed? What happens to statements in transactions that are rolled back? What happens to a statement that is executed partially because it failed partway (e.g. because of division by zero)? 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. -- Alvaro Herrera http://www.CommandPrompt.com/ The PostgreSQL Company - Command Prompt, Inc.