pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rajesh Kumar Mallah. <mallah@trade-india.com>
From: (by way of Rajesh Kumar Mallah. <mallah@trade-india.com>
To: pgsql-admin@postgresql.org
Subject: Profiling of SQL queries...
Date: Mon, 13 May 2002 10:14:12 +0530
Message-ID: <200205131014.12623.mallah@trade-india.com> (raw)

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 = true
debug_pretty_print = true
show_query_stats = 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 = 25.48% 
!       Local  blocks:          0 read,          0 written, buffer hit rate = 0.00% 
!       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.




Message-ID: <200205131014.12623.mallah@trade-india.com>
Permalink:  ../200205131014.12623.mallah@trade-india.com/
Also on:    postgresql.org/message-id/200205131014.12623.mallah@trade-india.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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: mallah@trade-india.com
  Subject: Re: Profiling of SQL queries...
  In-Reply-To: <200205131014.12623.mallah@trade-india.com>
  References: <200205131014.12623.mallah@trade-india.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