pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tomas Vondra <tv@fuzzy.cz>
To: Mindaugas <mind@bi.lt>
Cc: pgsql-performance@postgresql.org
Subject: Re: How to analyze function performance
Date: Thu, 15 Jun 2006 15:03:25 +0200
Message-ID: <44915A9D.6090407@fuzzy.cz> (raw)
In-Reply-To: <016401c69075$8a35e8c0$f20214ac@bite.lt>
References: <016401c69075$8a35e8c0$f20214ac@bite.lt>

It depends what is the purpose of the function. If it's mainly a
container for a heap of SQL queries along with some simple IF, ELSE
etc. then I use two simple ways to analyze the performance (or lack
of performance):

1) I use a lot of debug messages

2) I print out all SQL and the execute EXPLAIN / EXPLAIN ANALYZE on them

If the function is mainly a computation of something, it's usually nice
to try to use for example C language, as it's much faster than PL/pgSQL
for this type of functions.

But it depends on what you are trying to do in that function ...

Tomas

>   Hello,
> 
>   Is it possible to somehow analyze function performance? E.g.
> we are using function cleanup() which takes obviously too much time
> to execute but I have problems trying to figure what is slowing things
> down.
> 
>   When I explain analyze function lines step by step it show quite
> acceptable performance.
> 
>   PostgreSQL 8.0 is running on two dual core Opterons.
> 
>   Thanks,
> 
>   Mindaugas



view thread (3+ messages)  latest in thread

Message-ID: <44915A9D.6090407@fuzzy.cz>
Permalink:  ../44915A9D.6090407@fuzzy.cz/
Also on:    postgresql.org/message-id/44915A9D.6090407@fuzzy.cz

 · 

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: tv@fuzzy.cz, mind@bi.lt
  Subject: Re: How to analyze function performance
  In-Reply-To: <44915A9D.6090407@fuzzy.cz>

* 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