From: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> |
---|---|
To: | Rémi Cura <remi(dot)cura(at)gmail(dot)com>, Jeff Janes <jeff(dot)janes(at)gmail(dot)com> |
Cc: | PostgreSQL General <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: python modul pre-import to avoid importing each time |
Date: | 2014-06-26 13:18:10 |
Message-ID: | 53AC1D92.6060606@aklaver.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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(dot)klaver(at)aklaver(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Merlin Moncure | 2014-06-26 13:20:18 | Re: Alternative to psql -c ? |
Previous Message | James Le Cuirot | 2014-06-26 12:59:06 | Re: Alternative to psql -c ? |