From: | "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com> |
---|---|
To: | Phoenix Kiula <phoenix(dot)kiula(at)gmail(dot)com> |
Cc: | PG-General Mailing List <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Any risks in using FUNCTIONs (stored procedures) instead of raw sql queries? |
Date: | 2008-11-18 18:56:06 |
Message-ID: | 1227034566.7298.22.camel@jd-laptop.pragmaticzealot.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Wed, 2008-11-19 at 02:18 +0800, Phoenix Kiula wrote:
> I am looking to convert all my database access code into stored
> procedures in PL/PGSQL.
> But a DBA told me that it will be much better to do all of these
> things in a stored procedure as it may bring some performance
> benefits. He's an oracle DBA so I am not sure if the same applies to
> PG? Will a "function" that takes input values with 15 column data
> fields including two TEXT fields and then outputs perhaps an array of
> values to a PHP program be faster than 2-3 separate SQL queries issues
> from PHP?
>
Generally speaking, yes. A stored procedure will be faster, if nothing
else you don't have to deal with TCP delay. You will also want to make
sure you are utilizing a connection pool.
For database design, especially when dealing with web developers I find
it is always good to have them review:
http://www-01.ibm.com/support/docview.wss?uid=nas191f301ccd7abae2f862565c2007cf178
Joshua D. Drake
> Thanks for any input. Or please point me online to any resource that
> discusses this kind of info. I could not find any.
>
> PK
>
--
From | Date | Subject | |
---|---|---|---|
Next Message | Jonah H. Harris | 2008-11-18 19:00:09 | Re: MVCC and index-only read |
Previous Message | Tom Lane | 2008-11-18 18:46:22 | Re: MVCC and index-only read |