pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
profiling PL/pgSQL?
5+ messages / 5 participants
[nested] [flat]

* profiling PL/pgSQL?
@ 2006-11-03 11:12  Drew Wilson <drewmwilson@gmail.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Drew Wilson @ 2006-11-03 11:12 UTC (permalink / raw)
  To: pgsql-performance

I have 700 lines of non-performant pgSQL code that I'd like to  
profile to see what's going on.

What's the best way to profile stored procedures?

Thanks,

Drew



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: profiling PL/pgSQL?
@ 2006-11-03 11:21  A. Kretschmer <andreas.kretschmer@schollglas.com>
  parent: Drew Wilson <drewmwilson@gmail.com>
  0 siblings, 1 reply; 5+ messages in thread

From: A. Kretschmer @ 2006-11-03 11:21 UTC (permalink / raw)
  To: pgsql-performance

am  Fri, dem 03.11.2006, um  3:12:14 -0800 mailte Drew Wilson folgendes:
> I have 700 lines of non-performant pgSQL code that I'd like to  
> profile to see what's going on.
> 
> What's the best way to profile stored procedures?

RAISE NOTICE, you can raise the aktual time within a transaction with
timeofday()


Andreas
-- 
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47215,   D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID:   0x3FFF606C, privat 0x7F4584DA   http://wwwkeys.de.pgp.net



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: profiling PL/pgSQL?
@ 2006-11-03 12:07  Richard Huxton <dev@archonet.com>
  parent: A. Kretschmer <andreas.kretschmer@schollglas.com>
  0 siblings, 2 replies; 5+ messages in thread

From: Richard Huxton @ 2006-11-03 12:07 UTC (permalink / raw)
  To: A. Kretschmer <andreas.kretschmer@schollglas.com>; +Cc: pgsql-performance

A. Kretschmer wrote:
> am  Fri, dem 03.11.2006, um  3:12:14 -0800 mailte Drew Wilson folgendes:
>> I have 700 lines of non-performant pgSQL code that I'd like to  
>> profile to see what's going on.
>>
>> What's the best way to profile stored procedures?
> 
> RAISE NOTICE, you can raise the aktual time within a transaction with
> timeofday()

Of course you only have very small values of "best" available with 
plpgsql debugging.

There's a GUI debugger from EnterpriseDB I believe, but I've no idea how 
good it is. Any users/company bods care to let us know?

-- 
   Richard Huxton
   Archonet Ltd



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: profiling PL/pgSQL?
@ 2006-11-03 15:27  Jonah H. Harris <jonah.harris@gmail.com>
  parent: Richard Huxton <dev@archonet.com>
  1 sibling, 0 replies; 5+ messages in thread

From: Jonah H. Harris @ 2006-11-03 15:27 UTC (permalink / raw)
  To: Richard Huxton <dev@archonet.com>; +Cc: A. Kretschmer <andreas.kretschmer@schollglas.com>; pgsql-performance

On 11/3/06, Richard Huxton <dev@archonet.com> wrote:
> There's a GUI debugger from EnterpriseDB I believe, but I've no idea how
> good it is. Any users/company bods care to let us know?

If you visit:
http://cvs.pgfoundry.org/cgi-bin/cvsweb.cgi/edb-debugger/#dirlist

We have both a PL/pgSQL profiler and tracer available.

-- 
Jonah H. Harris, Software Architect | phone: 732.331.1300
EnterpriseDB Corporation            | fax: 732.331.1301
33 Wood Ave S, 2nd Floor            | jharris@enterprisedb.com
Iselin, New Jersey 08830            | http://www.enterprisedb.com/



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: profiling PL/pgSQL?
@ 2006-11-03 19:40  korryd@enterprisedb.com
  parent: Richard Huxton <dev@archonet.com>
  1 sibling, 0 replies; 5+ messages in thread

From: korryd@enterprisedb.com @ 2006-11-03 19:40 UTC (permalink / raw)
  To: Richard Huxton <dev@archonet.com>; +Cc: A. Kretschmer <andreas.kretschmer@schollglas.com>; pgsql-performance

> > am  Fri, dem 03.11.2006, um  3:12:14 -0800 mailte Drew Wilson folgendes:
> >> I have 700 lines of non-performant pgSQL code that I'd like to  
> >> profile to see what's going on.
> >>
> >> What's the best way to profile stored procedures?
> > 
> > RAISE NOTICE, you can raise the aktual time within a transaction with
> > timeofday()
> 
> Of course you only have very small values of "best" available with 
> plpgsql debugging.
> 
> There's a GUI debugger from EnterpriseDB I believe, but I've no idea how 
> good it is. Any users/company bods care to let us know?



It's an excellent debugger (of course, I'm a bit biased).  

We are working on open-sourcing it now - we needed some of the plugin
features in 8.2.

As Jonah pointed out, we also have a PL/pgSQL profiler (already
open-sourced but a bit tricky to build).  The profiler tells you how
much CPU time you spent at each line of PL/pgSQL code, how many times
you executed each line of code, and how much I/O was caused by each line
(number of scans, blocks fetched, blocks hit, tuples returned, tuples
fetched, tuples inserted, tuples updated, tuples deleted).

It's been a while since I looked at it, but I seem to remember that it
spits out an XML report that you can coax into a nice HTML page via the
XSLT.

The plugin_profiler needs to be converted over to the plugin
architecture in 8.2, but that's not a lot of work.

                -- Korry


--
  Korry Douglas    korryd@enterprisedb.com
  EnterpriseDB      http://www.enterprisedb.com

^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2006-11-03 19:40 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-11-03 11:12 profiling PL/pgSQL? Drew Wilson <drewmwilson@gmail.com>
2006-11-03 11:21 ` A. Kretschmer <andreas.kretschmer@schollglas.com>
2006-11-03 12:07   ` Richard Huxton <dev@archonet.com>
2006-11-03 15:27     ` Jonah H. Harris <jonah.harris@gmail.com>
2006-11-03 19:40     ` korryd@enterprisedb.com

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