We have some PL/pgSQL stored procedures in our DB (PostgreSQL 9.x).
These are strictly sequential, and under some circumstances, can be very slow.
We are thinking on porting these to PL/Java, PL/Python or something like these, and exploit the multithreading abilities of these languages.
The main question is: how "effectively" these language supports are implemented? For example, I'm thinking on the Virtual Machines that run Java code: when calling my PL/Java code, each time it summons a new VM for it, or does PL/Java keeps some kind of pool of VMs, and associate one of them for the actual call?