Received: from localhost.localdomain (postgresql.org [64.49.215.8]) by localhost (Postfix) with ESMTP id 94CD04759BD for ; Mon, 13 May 2002 00:44:59 -0400 (EDT) Received: from mail-relay.trade-india.com (mail-relay.trade-india.com [203.196.129.235]) by postgresql.org (Postfix) with SMTP id 7F4EF4759A9 for ; Mon, 13 May 2002 00:44:50 -0400 (EDT) Received: (qmail 1389 invoked from network); 13 May 2002 04:38:39 -0000 Received: from system29.trade-india-local.com (HELO server) (192.168.0.29) by ptil-236-129-del.primus-india.net with SMTP; 13 May 2002 04:38:39 -0000 Content-Type: text/plain; charset="iso-8859-1" From: "Rajesh Kumar Mallah." (by way of Rajesh Kumar Mallah. ) Organization: Infocom Network Limited. Subject: Profiling of SQL queries... Date: Mon, 13 May 2002 10:14:12 +0530 X-Mailer: KMail [version 1.4] To: pgsql-admin@postgresql.org MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200205131014.12623.mallah@trade-india.com> X-Archive-Number: 200205/106 X-Sequence-Number: 4281 Hi there, I wanted to make a *rough* estimates of how much time does each of the SQL query sent to Postgresql takes. The objective is to indentify slow running queries and optimise them. also to do some statistical analysis on the queries , like most frequent queries etc ,etc. To accomplish it i was thinking to run postmaster with ---------------------------- debug_print_query =3D true debug_pretty_print =3D true show_query_stats =3D true ---------------------------- and use perl to process the log files it generates, eg when i execute "select count(*) from users;" this i get in my logfile. ------------------------------------------------------ DEBUG: query: SELECT count(*) from users; DEBUG: QUERY STATISTICS ! system usage stats: ! 0.519799 elapsed 0.090000 user 0.080000 system sec ! [0.100000 user 0.090000 sys total] ! 0/0 [0/0] filesystem blocks in/out ! 271/5 [573/126] page faults/reclaims, 0 [0] swaps ! 0 [0] signals rcvd, 0/0 [0/0] messages rcvd/sent ! 0/0 [0/0] voluntary/involuntary context switches ! postgres usage stats: ! Shared blocks: 781 read, 0 written, buffer hit rate= =3D 25.48%=20 ! Local blocks: 0 read, 0 written, buffer hit rate= =3D 0.00%=20 ! Direct blocks: 0 read, 0 written ------------------------------------------------------ my question is is there a more earier/elegant way of doing it? also i seek suggestion on which all figures in the log output above are important shud i concentrate on the "elaspsed duration" of .519799 sec or any other figures are also imporatant. thanks in advance for comments/suggestions regds mallah. -- Rajesh Kumar Mallah, Project Manager (Development) Infocom Network Limited, New Delhi phone: +91(11)6152172 (221) (L) ,9811255597 (M) Visit http://www.trade-india.com , India's Leading B2B eMarketplace.