Thread: Functions and query analysis - EXPLAIN
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?
Thanks,
Andy
Perhaps there's a better way of determining if my function is using the indexes I'd like it to use?
Thanks,
Andy
Andy Halsall <halsall_andy@hotmail.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°