pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jim C. Nasby <jnasby@pervasive.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
To: Dan Gorman <dgorman@hi5.com>
To: mischa@ca.sophos.com
To: pgsql-performance@postgresql.org
Subject: Re: Selects query stats?
Date: Tue, 23 May 2006 15:02:48 -0500
Message-ID: <20060523200248.GY64371@pervasive.com> (raw)
In-Reply-To: <20060523195001.GH28863@surnet.cl>
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>

On Tue, May 23, 2006 at 03:50:01PM -0400, Alvaro Herrera wrote:
> 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.

Yeah, I doubt any other database gets mired neck-deep in exact details
of statment execution counts; a simple count of queries executed via a
client connection would be a great start.

I often run into situations where people are having a performance issue
because they're building web pages that make 50 queries to the database.
Being able to identify that and determine how many were selects vs. DML
would be useful.

Bonus points if there are seperate counters for statements from
functions.
-- 
Jim C. Nasby, Sr. Engineering Consultant      jnasby@pervasive.com
Pervasive Software      http://pervasive.com    work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf       cell: 512-569-9461



view thread (19+ messages)  latest in thread

Message-ID: <20060523200248.GY64371@pervasive.com>
Permalink:  ../20060523200248.GY64371@pervasive.com/
Also on:    postgresql.org/message-id/20060523200248.GY64371@pervasive.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: jnasby@pervasive.com, tgl@sss.pgh.pa.us, dgorman@hi5.com, mischa@ca.sophos.com
  Subject: Re: Selects query stats?
  In-Reply-To: <20060523200248.GY64371@pervasive.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox