Re: [GENERAL] python modul pre-import to avoid importing each time

2014-06-27 Thread Rémi Cura
Hey, thanks, now we have good information: the python package are really loaded once per connection, so no optimization is needed. Unlike plperl or plR there is no easy way to preload packages. There may be some solutions to make this import at connection start but it would involve C modification

Re: [GENERAL] python modul pre-import to avoid importing each time

2014-06-26 Thread Adrian Klaver
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 got to thinking about this. 100K over what time frame? How is it being called? -- Adri

Re: [GENERAL] python modul pre-import to avoid importing each time

2014-06-26 Thread Tom Lane
Adrian Klaver writes: > On 06/26/2014 02:14 AM, Rémi Cura wrote: >> 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

Re: [GENERAL] python modul pre-import to avoid importing each time

2014-06-26 Thread Jeff Janes
On Thu, Jun 26, 2014 at 2: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.co

Re: [GENERAL] python modul pre-import to avoid importing each time

2014-06-26 Thread Adrian Klaver
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/h

Re: [GENERAL] python modul pre-import to avoid importing each time

2014-06-26 Thread Rémi Cura
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-handle

Re: [GENERAL] python modul pre-import to avoid importing each time

2014-06-25 Thread Jeff Janes
On Thu, Jun 19, 2014 at 7:50 AM, Rémi Cura wrote: > Hey List, > > I use plpython with postgis and 2 python modules (numpy and shapely). > Sadly importing such module in the plpython function is very slow (several > hundreds of milliseconds). Is that mostly shapely (which I don't have)? numpy see

[GENERAL] python modul pre-import to avoid importing each time

2014-06-19 Thread Rémi Cura
Hey List, I use plpython with postgis and 2 python modules (numpy and shapely). Sadly importing such module in the plpython function is very slow (several hundreds of milliseconds). I also don't know if this overhead is applied each time the function is called in the same session. Is there a way