0

I have a question regarding the execution of a Python UDF. Let's suppose I have a UDF named testUDF(...) and I apply it to table "testtable". When I run the query SELECT testUDF(...) from testtable, I get the correct result (I omitted the params of the UDF on purpose).

However, when I want to check the query plan for this query, the UDF is not included in there. I used

 EXPLAIN ANALYZE 
 SELECT testUDF(...) 
 from testtable

and

 EXPLAIN 
 SELECT testUDF(...) 
 from testtable. 

In both cases, the output only shows a seq. scan but the UDF is not mentioned anywhere. For more complex queries, I am interested in how to see at which position of the query plan the UDF is executed. How is this possible? Many thanks in advance for your help!

asked Nov 17, 2022 at 3:07
3
  • I did follow the steps described here but the output was similar to the normal EXPLAIN. The UDF did not show up as part of the query plan.dba.stackexchange.com/questions/23355/… Commented Nov 17, 2022 at 4:42
  • 2
    You need explain (verbose) (or explain (analyze, verbose) to see that the function is called. That would include e.g. Output: testudf(...) but you will never see the execution plan for statements inside the function if that is what you are hoping for. Commented Nov 17, 2022 at 5:57
  • @a_horse_with_no_name That qualifies as an answer. Commented Nov 17, 2022 at 7:09

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.