pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andy Colson <andy@squeakycode.net>
To: Sabin Coanda <sabin.coandaSPAMPROTECTION@deuromedia.ro>
To: pgsql-performance@postgresql.org
Subject: Re: How check execution plan of a function
Date: Thu, 08 Apr 2010 10:44:09 -0500
Message-ID: <4BBDF9C9.9050504@squeakycode.net> (raw)
In-Reply-To: <hphv0u$18f$1@news.hub.org>
References: <hphv0u$18f$1@news.hub.org>

On Wed Apr 7 2010 7:47 AM, Sabin Coanda wrote:
> Hi there,
>
> I have a function which returns setof record based on a specific query.
> I try to check the execution plan of that query, so I write EXPLAIN ANALYZE
> before my select, I call the function and I see the result which shows an
> actual time about 5 seconds. But when I call my function after I remove
> EXPLAIN ANALYZE it takes more than 300 seconds, and I cancel it.
>
> What's happen, or how can I see the function execution plan to optimize it ?
>
> TIA,
> Sabin
>
>

I ran into the same problems, what I did was enable the logging in 
postgresql.conf.  I dont recall exactly what I enabled, but it was 
something like:

track_functions = pl

log_statement_stats = on
log_duration = on

Then in the serverlog you can see each statement, and how long it took. 
  Once I found a statement that was slow I used explain analyze on just 
it so I could optimize that one statement.

-Andy




view thread (6+ messages)  latest in thread

Message-ID: <4BBDF9C9.9050504@squeakycode.net>
Permalink:  ../4BBDF9C9.9050504@squeakycode.net/
Also on:    postgresql.org/message-id/4BBDF9C9.9050504@squeakycode.net

 · 

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: andy@squeakycode.net, sabin.coandaSPAMPROTECTION@deuromedia.ro
  Subject: Re: How check execution plan of a function
  In-Reply-To: <4BBDF9C9.9050504@squeakycode.net>

* 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