Caching Python modules

Поиск
Список
Период
Сортировка
От PostgreSQL - Hans-Jürgen Schönig
Тема Caching Python modules
Дата
Msg-id 682AACCD-6E75-4A1F-9A19-16FDE8BAC922@cybertec.at
обсуждение исходный текст
Ответы Re: Caching Python modules  (Jan Urbański <wulczer@wulczer.org>)
Список pgsql-hackers
hello …

i have just fallen over a nasty problem (maybe missing feature) with PL/Pythonu …
consider:

-- add a document to the corpus
CREATE OR REPLACE FUNCTION textprocess.add_to_corpus(lang text, t text) RETURNS float4 AS $$
       from SecondCorpus import SecondCorpus       from SecondDocument import SecondDocument

i am doing some intense text mining here.
the problem is: is it possible to cache those imported modules from function to function call.
GD works nicely for variables but can this actually be done with imported modules as well?
the import takes around 95% of the total time so it is definitely something which should go away somehow.
i have checked the docs but i am not more clever now.
many thanks,
    hans

--
Cybertec Schönig & Schönig GmbH
Gröhrmühlgasse 26
A-2700 Wiener Neustadt, Austria
Web: http://www.postgresql-support.de



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Fujii Masao
Дата:
Сообщение: Re: Online base backup from the hot-standby
Следующее
От: Jan Urbański
Дата:
Сообщение: Re: Caching Python modules