Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1T3vgL-0003I3-CC for pgsql-performance@postgresql.org; Tue, 21 Aug 2012 21:08:13 +0000 Received: from [2001:1528:137::f1] (helo=mail.gransy.com) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1T3vgJ-0002OX-Oj for pgsql-performance@postgresql.org; Tue, 21 Aug 2012 21:08:12 +0000 Received: from antispam.gransy.com (antispam.gransy.com [77.78.104.124]) by mail.gransy.com (Postfix) with ESMTP id A04775089E3 for ; Tue, 21 Aug 2012 23:08:09 +0200 (CEST) Received: from mail.gransy.com ([82.208.44.189]) by antispam.gransy.com (antispam.gransy.com [77.78.104.124]) (amavisd-new, port 10024) with ESMTP id WD73X9+pwEED for ; Tue, 21 Aug 2012 23:08:09 +0200 (CEST) Received: by mail.gransy.com (Postfix, from userid 5000) id 50DD25089EC; Tue, 21 Aug 2012 23:08:09 +0200 (CEST) Received: from [192.168.1.237] (ip-78-45-133-255.net.upcbroadband.cz [78.45.133.255]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.gransy.com (Postfix) with ESMTPSA id 34A8F5089E3 for ; Tue, 21 Aug 2012 23:08:09 +0200 (CEST) Message-ID: <5033F8B9.4080806@fuzzy.cz> Date: Tue, 21 Aug 2012 23:08:09 +0200 From: Tomas Vondra User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120713 Thunderbird/14.0 MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: average query performance measuring References: <362605510214004CB3313A03D3D697DE5508FF27@cmhvm005> In-Reply-To: <362605510214004CB3313A03D3D697DE5508FF27@cmhvm005> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2001:1528:137::f1 (failed) X-Pg-Spam-Score: -1.1 (-) X-Archive-Number: 201208/146 X-Sequence-Number: 47684 On 21.8.2012 20:35, Rick Otten wrote: > I have a PostgreSQL 9.1 cluster. Each node is serving around 1,000 > queries per second when we are at a =91steady state=92. >=20 > What I=92d like to know is the average query time. I=92d like to see i= f > query performance is consistent, or if environmental changes, or code > releases, are causing it to drift, spike, or change. I=92d also like = to > be able to compare the (real) query performance on the different nodes. >=20 > I know I can put some sort of query wrapper at the application layer to > gather and store timing info. (I=92m not sure yet how the application > would know which node the query just ran on since we are using pgpool > between the app and the db.) I=92d much rather get something directly > out of each database node if I can. >=20 > Turning on statement logging crushes the database performance, so I > don=92t want to do that either. (Not to mention I=92d still have to pa= rse > the logs to get the data.) >=20 > It seems like we almost have everything we need to track this in the > stats tables, but not quite. I was hoping the folks on this list would > have some tips on how to get query performance trends over time out of > each node in my cluster. As others already mentioned, the improvements in pg_stat_statements by Peter Geoghean in 9.2 is the first thing you should look into I guess. Especially if you're looking for per-query stats. If you're looking for "global stats," you might be interested in an extension I wrote a few months ago and collects query histogram. It's available on pgxn.org: http://pgxn.org/dist/query_histogram/ The question is whether tools like this can give you reliable answers to your questions - that depends on your workload (how much it varies) etc. Tomas