I have a PostgreSQL function with Language plpgsql. Since the EXPLAIN ANALYZE VERBOSE for my function executed like this:


doesn't seem to log any valuable details except the following:

"Result  (cost=0.00..5.25 rows=1000 width=32) (actual time=122.115..122.204 rows=25 loops=1)"
"  Output: postgre.foo()"
"Planning time: 0.026 ms"
"Execution time: 122.243 ms"

I wanted to know if there is any way I can see the real query\queries used by the function, so that I can do EXPLAIN ANALYZE on these SQL queries.



In psql just do \sf name_of_function and it will show you the source code. Or \ef will load it into an editor.

| improve this answer | |
  • Why the downvote? This answers the question of how to see the real query – Gaius May 11 '18 at 22:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.