Re: Explaining functions. - Mailing list pgsql-general

From Tom Lane
Subject Re: Explaining functions.
Date
Msg-id 13651.1245765872@sss.pgh.pa.us
Whole thread Raw
In response to Re: Explaining functions.  (Merlin Moncure <mmoncure@gmail.com>)
Responses Re: Explaining functions.
List pgsql-general
Merlin Moncure <mmoncure@gmail.com> writes:
> On Tue, Jun 23, 2009 at 8:03 AM, Hartman,
> Matthew<Matthew.Hartman@krcc.on.ca> wrote:
>> Is there a recommended approach when trying to use EXPLAIN on a
>> function? Specifically, a function that is more than the typical SELECT
>> statement or tiny loop. The one in question that I'm hoping to optimize
>> is around 250 lines.

> What I normally do for benchmarking of complex functions is to
> sprinkle the source with "raise notice '%', timeofday();" to figure
> out where the bottlenecks are.  Following that, I micro-optimize
> problem queries or expressions outside of the function body in psql.

There was some discussion once of using the same infrastructure the
plpgsql debugger uses to build a plpgsql profiler.  That would help
automate the first part of this, at least.  Anybody know the status
of that project?

            regards, tom lane

pgsql-general by date:

Previous
From: Jack Orenstein
Date:
Subject: Re: Slight change in query leads to unexpected change in query plan
Next
From: Tom Lane
Date:
Subject: Re: Slight change in query leads to unexpected change in query plan