Skip site navigation (1) Skip section navigation (2)

Re: How to analyze function performance

From: Tomas Vondra <tv(at)fuzzy(dot)cz>
To: Mindaugas <mind(at)bi(dot)lt>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: How to analyze function performance
Date: 2006-06-15 13:03:25
Message-ID: 44915A9D.6090407@fuzzy.cz (view raw or flat)
Thread:
Lists: pgsql-performance
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

In response to

pgsql-performance by date

Next:From: Tom LaneDate: 2006-06-15 14:24:04
Subject: Re: How to analyze function performance
Previous:From: MindaugasDate: 2006-06-15 12:16:32
Subject: How to analyze function performance

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group