![]() | |
![]() |
| | Thread Tools | Display Modes |
#11
| ||||||
| ||||||
|
|
Anselmo Canfora wrote: now I am wondering how PG manage the perl interpreter, I am not a C programmer, so I do not know a lot of things, however I would like to understand something about the performance of perl stored procedures in PG, for example if they are managed in a similar manner of apache/mod_perl, and if they are as fast as it in same tasks. I don't know much about Perl and nothing about mod_perl, so I cannot compare the two. |
|
It seems that the language handler loads the interpreter as shared library: Yes, that is the way that you embed Perl into a C program. See "man perlembed" for details. And here: http://www.postgresql.org/docs/curre...FUNC-C-DYNLOAD it is stated that "Presently, unloads are disabled and will never occur, but this may change in the future", so is it correct to think that the libperl.so* is kept in memory after the first invocation? If yes, is it the perl stored procedure AST compiled on creation and then kept in memory after the first invocation? As soon as PL/Perl has been loaded into the backend process, it will remain there. So it remains loaded for the rest of the session. There will be one Perl interpreter created per backend, or two if you use both trusted and untrusted Perl in the same session. |
|
Stored procedures are realised as anonymous perl subroutines and are cached (you can see that from the source; my Perl knowledge is not sufficient to tell if that means that they are compiled only once, but I'd guess so). |

|
To see the PL/Perl implementation, look here: http://anoncvs.postgresql.org/cvsweb...h_tag=REL8_4_2 (it is currently being rewritten, so it's better to look at a stable branch). |

|
I don't know what AST is, could you explain? |
|
Another question, there are not references to language handlers here? root@pluto:/usr/lib/postgresql/8.3# ldd bin/post* | grep -i pl root@pluto:/usr/lib/postgresql/8.3# Yes, because they are not linked with the database server. They are loaded at runtime as soon as they are needed. Yours, Laurenz Albe |
#12
| |||
| |||
|
|
There will be one Perl interpreter created per backend, or two if you use both trusted and untrusted Perl in the same session. so, one (trusted/untrusted) interpreter per connection? |
![]() |
| Thread Tools | |
| Display Modes | |
| |