When a PL/Python procedure is executed, the python code is executed by a Python interpreter. My question is, is the Python interpreter running as a separate process, or is it a shared library that gets linked to the calling databases process?
I'm concerned about what happens when we call something like plpy.execute(...). If the python interpreter is running as a separate process I imagine there would be a lot of overhead involved in passing the result of the sql query back to the python interpreter, which would require reading from a file or pipe.