On 06/26/2014 02:14 AM, Rémi Cura wrote:
Hey, thanks for your answer ! Yep you are right, the function I would like to test are going to be called a lot (100k times), so even 15 ms per call matters. I'm still a bit confused by a topic I found here : http://stackoverflow.com/questions/15023080/how-are-import-statements-in-plpython-handled The answer gives a trick to avoid importing each time, so somehow it must be usefull.
Peters answer is based on using the global dictionary SD to store an imported library. For more information see here:
http://www.postgresql.org/docs/9.3/interactive/plpython-sharing.html
On another internet page (can't find it anymore) somebody mentioned this module loading at server startup, one way or another, but gave no precision. It seems that the "plpy" python module get loaded by default, would'nt it be possible to hack this module to add other import inside it?
In a sense that is what is being suggested above.
I also use PL/R (untrusted I guess) and you can create a special table to indicate which module to load at startup. Cheers, Rémi-C
-- Adrian Klaver adrian.klaver@xxxxxxxxxxx