Re: Writing most code in Stored Procedures

From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: Ron Johnson <ron(dot)l(dot)johnson(at)cox(dot)net>
Cc: PgSQL General ML <pgsql-general(at)postgresql(dot)org>
Subject: Re: Writing most code in Stored Procedures
Date: 2007-08-18 17:50:16
Message-ID: 46C73158.20601@commandprompt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ron Johnson wrote:
> On 08/18/07 11:08, Joshua D. Drake wrote:
>> Josh Tolley wrote:
>>> On 8/18/07, Ron Johnson <ron(dot)l(dot)johnson(at)cox(dot)net> wrote:
>>>> Interesting. Does PG have to initiate the Perl interpreter every
>>>> time you call a Perl-written SP?
>>> IIRC PostgreSQL should only load the perl interpreter once per session.
>> Right.
>
> I'd have been stunned if you did it any other way.
>
> So why is Perl-SP-INSERT so much slower than Perl-SQL-INSERT?
>
> (I can imagine that the SP code path would be longer, but since IO
> is the slowest part of the system, I'm surprised that it's *that*
> much slower.)

We would have to see his script as there are several variables at hand here.

1. Is he using do or execute with his perl-sql? If he is using execute
then he is getting the advantage of prepared query inserts.

2. Did he use a single transaction? If so then he is not paying for 2
million commits, which he would be with the procedure.

Sincerely,

Joshua D. Drake

- ---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

- --

=== The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 24x7/Emergency: +1.800.492.2240
PostgreSQL solutions since 1997 http://www.commandprompt.com/
UNIQUE NOT NULL
Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate
PostgreSQL Replication: http://www.commandprompt.com/products/

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGxzFYATb/zqfZUUQRAvUWAKCHm4EOtmrblRcnoVLVSEA0/Hd1JQCfTbgu
4tRGmCvqZSuBsGvQyUOQBzU=
=edfC
-----END PGP SIGNATURE-----

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2007-08-18 17:51:18 Re: SUBSTRING performance for large BYTEA
Previous Message Karsten Hilbert 2007-08-18 17:26:54 Re: SUBSTRING performance for large BYTEA