By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,374 Members | 1,939 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,374 IT Pros & Developers. It's quick & easy.

Pl/Perl speed

P: n/a
I am pretty sure I know this already, but every time you run a Pl/Perl
function it is just like running a perl script as far as having to load and
compile the code right? My application runs under mod perl so I'm thinking
that speed is not something I would gain by putting any of the code into the
database server via Pl/Perl.

Chris
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 22 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"Chris Ochs" <ch***@paymentonline.com> writes:
I am pretty sure I know this already, but every time you run a Pl/Perl
function it is just like running a perl script as far as having to load and
compile the code right?


No, the perl script gets compiled only the first time the function is
invoked (within a given backend session). Subsequent calls to the
function use the already-compiled function object. I'm not clear on
exactly how much overhead this saves in Perl, but it's certainly not
as bad as re-loading a script on each call.

I believe all the PL languages have comparable optimizations.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org

Nov 22 '05 #2

P: n/a
Chris Ochs wrote:
I am pretty sure I know this already, but every time you run a Pl/Perl
function it is just like running a perl script as far as having to load and
compile the code right? My application runs under mod perl so I'm thinking
that speed is not something I would gain by putting any of the code into the
database server via Pl/Perl.

You can also preload (if you are running Mammoth or 7.4) the plperl.so
which should
give you a speed increase.

It entirely depends on what you are trying to do with pl/Perl however.
If you need
access to tuple data (ability to modify records etc...) then your kind
of out of luck.
However, if you are using it to perform logic and then spit back the
results pl/Perl
could be very useful and give a speed increase.

The speed increase would come from only returning the results of your
calculation
versus returning a set of data and then performing calculations on that
set and then
displaying it.

Sincerely,

Joshua D. Drake
Chris
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

--
Command Prompt, Inc., home of Mammoth PostgreSQL - S/ODBC and S/JDBC
Postgresql support, programming shared hosting and dedicated hosting.
+1-503-667-4564 - jd@commandprompt.com - http://www.commandprompt.com
Mammoth PostgreSQL Replicator. Integrated Replication for PostgreSQL
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org

Nov 22 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.