python modul pre-import to avoid importing each time - Mailing list pgsql-hackers

From Rémi Cura
Subject python modul pre-import to avoid importing each time
Date
Msg-id CAJvUf_ssimnOdJ39sianv76Lz6aep+jbgVB7T0b4W1ypbsc_SA@mail.gmail.com
Whole thread Raw
List pgsql-hackers
Hey List,
this is a repost from the general list where it get no responses (5 days)

I use plpython with postgis and 2 python modules (numpy and shapely).
Sadly importing such module in the plpython function is very slow (about half a second).

I also don't know if this overhead is applied each time the function is called in the same session.

Is there a way to pre-import those modules once and for all (at server start up for example),
such that the python function are accelerated?

Thanks,

Cheers,
Rémi-C

pgsql-hackers by date:

Previous
From: Soroosh Sardari
Date:
Subject: Re: Add a filed to PageHeaderData
Next
From: Etsuro Fujita
Date:
Subject: Re: inherit support for foreign tables