pg.ddx.io pgsql-performance@postgresql.org mailing list archive
help / color / mirror / Atom feedplperl vs plpgsql
6+ messages / 4 participants
[nested] [flat]
* plperl vs plpgsql
@ 2005-04-15 11:49 Alex <alex@meerkatsoft.com>
2005-04-15 12:57 ` Re: plperl vs plpgsql Christopher Browne <cbbrowne@acm.org>
0 siblings, 1 reply; 6+ messages in thread
From: Alex @ 2005-04-15 11:49 UTC (permalink / raw)
To: pgsql-performance
Hi,
i am thinking about swiching to plperl as it seems to me much more
flexible and easier to create functions.
what is the recommended PL for postgres? or which one is most widely
used / most popular?
is there a performance difference between plpgsql and plperl ?
porting to other systems is not a real issue as all my servers have perl
installed.
Thanks for any advice
Alex
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: plperl vs plpgsql
2005-04-15 11:49 plperl vs plpgsql Alex <alex@meerkatsoft.com>
@ 2005-04-15 12:57 ` Christopher Browne <cbbrowne@acm.org>
2005-04-17 12:56 ` Re: plperl vs plpgsql Alex <alex@meerkatsoft.com>
0 siblings, 1 reply; 6+ messages in thread
From: Christopher Browne @ 2005-04-15 12:57 UTC (permalink / raw)
To: pgsql-performance
After takin a swig o' Arrakan spice grog, alex@meerkatsoft.com (Alex) belched out:
> i am thinking about swiching to plperl as it seems to me much more
> flexible and easier to create functions.
>
> what is the recommended PL for postgres? or which one is most widely
> used / most popular?
> is there a performance difference between plpgsql and plperl ?
If what you're trying to do is "munge text," pl/perl will be a whole
lot more suitable than pl/pgsql because it has a rich set of text
mungeing tools and string functions which pl/pgsql lacks.
If you intend to do a lot of work involving reading unmunged tuples
from this table and that, pl/pgsql provides a much more natural
syntax, and will probably be a bit faster as the query processor may
even be able to expand some of the actions, rather than needing to
treat Perl code as an "opaque blob."
I would definitely be inclined to use the more natural language for
the given task...
--
wm(X,Y):-write(X),write('@'),write(Y). wm('cbbrowne','acm.org').
http://linuxdatabases.info/info/internet.html
"If you want to talk with some experts about something, go to the bar
where they hang out, buy a round of beers, and they'll surely talk
your ear off, leaving you wiser than before.
If you, a stranger, show up at the bar, walk up to the table, and ask
them to fax you a position paper, they'll tell you to call their
office in the morning and ask for a rate sheet." -- Miguel Cruz
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: plperl vs plpgsql
2005-04-15 11:49 plperl vs plpgsql Alex <alex@meerkatsoft.com>
2005-04-15 12:57 ` Re: plperl vs plpgsql Christopher Browne <cbbrowne@acm.org>
@ 2005-04-17 12:56 ` Alex <alex@meerkatsoft.com>
2005-04-17 13:32 ` Re: plperl vs plpgsql Stefan Weiss <spaceman@foo.at>
2005-04-17 13:51 ` Re: plperl vs plpgsql Joshua D. Drake <jd@commandprompt.com>
2005-04-17 23:17 ` Re: plperl vs plpgsql Christopher Browne <cbbrowne@acm.org>
0 siblings, 3 replies; 6+ messages in thread
From: Alex @ 2005-04-17 12:56 UTC (permalink / raw)
To: Christopher Browne <cbbrowne@acm.org>; +Cc: pgsql-performance
Is there a performance difference between the two?
which of the PL is most widely used. One problem i have with the plpgsql
is that the quoting is really a pain.
Christopher Browne wrote:
>After takin a swig o' Arrakan spice grog, alex@meerkatsoft.com (Alex) belched out:
>
>
>>i am thinking about swiching to plperl as it seems to me much more
>>flexible and easier to create functions.
>>
>>what is the recommended PL for postgres? or which one is most widely
>>used / most popular?
>>is there a performance difference between plpgsql and plperl ?
>>
>>
>
>If what you're trying to do is "munge text," pl/perl will be a whole
>lot more suitable than pl/pgsql because it has a rich set of text
>mungeing tools and string functions which pl/pgsql lacks.
>
>If you intend to do a lot of work involving reading unmunged tuples
>from this table and that, pl/pgsql provides a much more natural
>syntax, and will probably be a bit faster as the query processor may
>even be able to expand some of the actions, rather than needing to
>treat Perl code as an "opaque blob."
>
>I would definitely be inclined to use the more natural language for
>the given task...
>
>
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: plperl vs plpgsql
2005-04-15 11:49 plperl vs plpgsql Alex <alex@meerkatsoft.com>
2005-04-15 12:57 ` Re: plperl vs plpgsql Christopher Browne <cbbrowne@acm.org>
2005-04-17 12:56 ` Re: plperl vs plpgsql Alex <alex@meerkatsoft.com>
@ 2005-04-17 13:32 ` Stefan Weiss <spaceman@foo.at>
2 siblings, 0 replies; 6+ messages in thread
From: Stefan Weiss @ 2005-04-17 13:32 UTC (permalink / raw)
To: pgsql-performance
On 2005-04-17 14:56, Alex wrote:
> Is there a performance difference between the two?
As Christopher already pointed out, it depends on what you want to do.
If you're doing some complex string processing, it will be easier (and
in some cases) faster to do in plperl, if you're mainly dealing with
sets, plpgsql will be better suited.
> which of the PL is most widely used.
plpgsql.
> One problem i have with the plpgsql
> is that the quoting is really a pain.
In current versions of PostgreSQL you can use $$ quoting, which should
make your life easier:
http://www.postgresql.org/docs/8.0/static/plpgsql-structure.html
http://www.postgresql.org/docs/8.0/static/plperl.html
HTH,
stefan
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: plperl vs plpgsql
2005-04-15 11:49 plperl vs plpgsql Alex <alex@meerkatsoft.com>
2005-04-15 12:57 ` Re: plperl vs plpgsql Christopher Browne <cbbrowne@acm.org>
2005-04-17 12:56 ` Re: plperl vs plpgsql Alex <alex@meerkatsoft.com>
@ 2005-04-17 13:51 ` Joshua D. Drake <jd@commandprompt.com>
2 siblings, 0 replies; 6+ messages in thread
From: Joshua D. Drake @ 2005-04-17 13:51 UTC (permalink / raw)
To: Alex <alex@meerkatsoft.com>; +Cc: Christopher Browne <cbbrowne@acm.org>; pgsql-performance
On Sun, 17 Apr 2005, Alex wrote:
> Is there a performance difference between the two?
Hello,
It depends on what you are using it for. My experience is that for some
reason plPGSQL is faster when looping but other than that they should
be very similar.
> which of the PL is most widely used. One problem i have with the plpgsql is
> that the quoting is really a pain.
plpgsql but I believe that will change in a short period of time.
Sincerely,
Joshua D. Drake
--
Command Prompt, Inc., Your PostgreSQL solutions company. 503-667-4564
Custom programming, 24x7 support, managed services, and hosting
Open Source Authors: plPHP, pgManage, Co-Authors: plPerlNG
Reliable replication, Mammoth Replicator - http://www.commandprompt.com/
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: plperl vs plpgsql
2005-04-15 11:49 plperl vs plpgsql Alex <alex@meerkatsoft.com>
2005-04-15 12:57 ` Re: plperl vs plpgsql Christopher Browne <cbbrowne@acm.org>
2005-04-17 12:56 ` Re: plperl vs plpgsql Alex <alex@meerkatsoft.com>
@ 2005-04-17 23:17 ` Christopher Browne <cbbrowne@acm.org>
2 siblings, 0 replies; 6+ messages in thread
From: Christopher Browne @ 2005-04-17 23:17 UTC (permalink / raw)
To: pgsql-performance
After a long battle with technology, alex@meerkatsoft.com (Alex), an earthling, wrote:
> Christopher Browne wrote:
>>After takin a swig o' Arrakan spice grog, alex@meerkatsoft.com (Alex) belched out:
>>>i am thinking about swiching to plperl as it seems to me much more
>>>flexible and easier to create functions.
>>>
>>>what is the recommended PL for postgres? or which one is most widely
>>>used / most popular?
>>>is there a performance difference between plpgsql and plperl ?
>>>
>>>
>>
>>If what you're trying to do is "munge text," pl/perl will be a whole
>>lot more suitable than pl/pgsql because it has a rich set of text
>>mungeing tools and string functions which pl/pgsql lacks.
>>
>>If you intend to do a lot of work involving reading unmunged tuples
>>from this table and that, pl/pgsql provides a much more natural
>>syntax, and will probably be a bit faster as the query processor may
>>even be able to expand some of the actions, rather than needing to
>>treat Perl code as an "opaque blob."
>>
>>I would definitely be inclined to use the more natural language for
>>the given task...
> Is there a performance difference between the two?
> which of the PL is most widely used. One problem i have with the
> plpgsql is that the quoting is really a pain.
You seem to be inclined to play the mistaken game of "Which language
is the fastest?" which encourages myopic use of bad benchmarks.
In 8.0, quoting in pl/pgsql is less of a pain, as you can use $$ as
the begin/end indicators.
Performance will always depend on what you're doing.
- If you doing heavy amounts of "text munging," Perl has highly
optimized library routines that you're likely to be taking
advantage of which will likely be way faster than any pl/pgsql
equivalent.
- If you are writing "set operations," operating on table data,
the fact that pl/pgsql won't need to 'context switch' between
language mode and 'accessing data from the database' mode will
probably make it a bit quicker than pl/Perl.
- If you need some sort of "ultimate fastness," then you might look to
writing in a language that compiles to assembler so that your loops
will run as quick and tight as possible, which would encourage
writing stored procedures in C. Alas, this is _way_ harder to debug
and deploy, and errors could pretty readily destroy your database
instance if they were sufficiently awful.
pl/pgsql is almost certainly the most widely used procedural language,
if you're into "popularity contests."
I would be very much inclined to start with whichever language makes
it the easiest to write and maintain the algorithms you plan to write.
I would only move to another language if the initial choice proved to
_systematically_ be a conspicuous bottleneck.
--
output = ("cbbrowne" "@" "gmail.com")
http://linuxdatabases.info/info/linuxdistributions.html
"One of the most dangerous things in the universe is an ignorant
people with real grievances. That is nowhere near as dangerous,
however, as an informed and intelligent society with grievances. The
damage that vengeful intelligence can wreak, you cannot even imagine."
-- Miles Teg, Heretics of Dune
^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2005-04-17 23:17 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-04-15 11:49 plperl vs plpgsql Alex <alex@meerkatsoft.com>
2005-04-15 12:57 ` Christopher Browne <cbbrowne@acm.org>
2005-04-17 12:56 ` Alex <alex@meerkatsoft.com>
2005-04-17 13:32 ` Stefan Weiss <spaceman@foo.at>
2005-04-17 13:51 ` Joshua D. Drake <jd@commandprompt.com>
2005-04-17 23:17 ` Christopher Browne <cbbrowne@acm.org>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox