EXPLAIN/EXPLAIN ANALYSE for pl/pgsql functions

Started by Hannu Krosingover 18 years ago3 messages
#1Hannu Krosing
hannu@skype.net

How much effort would it be to add EXPLAIN/EXPLAIN ANALYSE capability to
pl/pgsql functions?

what I mean, is either a special mode, where "SELECT my_plpgsql_func()"
would print all query plans instead or in addition to executing them, or
some way for EXPLAIN to pass some flags to functions so that they can
"do the right thing".

Hannu

#2Simon Riggs
simon@2ndquadrant.com
In reply to: Hannu Krosing (#1)
Re: EXPLAIN/EXPLAIN ANALYSE for pl/pgsql functions

On Mon, 2007-04-23 at 11:01 +0300, Hannu Krosing wrote:

How much effort would it be to add EXPLAIN/EXPLAIN ANALYSE capability to
pl/pgsql functions?

what I mean, is either a special mode, where "SELECT my_plpgsql_func()"
would print all query plans instead or in addition to executing them, or
some way for EXPLAIN to pass some flags to functions so that they can
"do the right thing".

I agree this is an important thing to have.

Index Advisor patch contains a solution to this issue: All SQL can be
explained, without needing to put the EXPLAIN keyword in front of each
SQL statement prior to execution. The next part of the functionality is
to re-run the EXPLAIN with hypothetical indexes, to see if the plan
would improve.

--
Simon Riggs
EnterpriseDB http://www.enterprisedb.com

#3Noname
korryd@enterprisedb.com
In reply to: Simon Riggs (#2)
Re: EXPLAIN/EXPLAIN ANALYSE for pl/pgsql functions

How much effort would it be to add EXPLAIN/EXPLAIN ANALYSE capability to
pl/pgsql functions?

what I mean, is either a special mode, where "SELECT my_plpgsql_func()"
would print all query plans instead or in addition to executing them, or
some way for EXPLAIN to pass some flags to functions so that they can
"do the right thing".

I agree this is an important thing to have.

This is a feature I would like to add to the elusive PL/pgSQL
debugger/tracer/profiler.

-- Korry