Re: Functions and query analysis - EXPLAIN

From: Andreas Kretschmer <akretschmer(at)spamfence(dot)net>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Functions and query analysis - EXPLAIN
Date: 2012-02-10 17:54:31
Message-ID: 20120210175431.GA13740@tux
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Andy Halsall <halsall_andy(at)hotmail(dot)com> wrote:

> Is it possible to use EXPLAIN from inside a function? Have seen this post http:
> //archives.postgresql.org/pgsql-general/2011-04/msg00750.php but can't get it
> to work on even a simple query. Need it to work on a query in a function with a
> UNION.
>
> Perhaps there's a better way of determining if my function is using the indexes
> I'd like it to use?

Not sure if i understand you, but i think, you are looking for the
module AUTO_EXPLAIN. With this, and auto_explain.log_nested_statements =
on, you can see the explain-output in your log.

Andreas
--
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect. (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly." (unknown)
Kaufbach, Saxony, Germany, Europe. N 51.05082°, E 13.56889°

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Alessandro Gagliardi 2012-02-10 21:28:17 insert fail gracefully if primary key already exists
Previous Message Andy Halsall 2012-02-10 17:07:21 Functions and query analysis - EXPLAIN