Skip site navigation (1) Skip section navigation (2)

Re: Prepared statements vs. Stored Procedures

From: Tobias Brox <tobias(at)nordicbet(dot)com>
To: Oliver Crosby <ryusei(at)gmail(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Prepared statements vs. Stored Procedures
Date: 2005-06-21 20:40:57
Message-ID: 20050621204057.GI22746@oppetid.no (view raw or flat)
Thread:
Lists: pgsql-performance
[Oliver Crosby - Tue at 03:46:03PM -0400]
> I'm hoping someone can offer some advice here.
>  I have a large perl script that employs prepared statements to do all its 
> queries. I'm looking at using stored procedures to improve performance times 
> for the script. Would making a stored procedure to replace each prepared 
> statement be worthwhile? If not, when could I use stored procedures to 
> improve performance?
>  Thanks in advance.

My gut feeling says that if you are only doing read-operations there are
none or almost none benefits with stored procedures.

One argument we used for not looking much into stored procedures, was
that we expect the database to become the bottleneck if we get too much
activity.  At the application side, we can always expand by adding more
boxes, but the database, beeing the hub of the system, cannot easily be
expanded (we can tweak and tune and upgrade the whole box, and
eventually at some point we believe we will need to put old data at a
separate database, and also make a replica for heavy report queries)

If you have loads of data going from the database to the application, a
little bit of light processing done on the data, and then data going
back to the database server, then I guess stored procedures would be
better.

In response to

pgsql-performance by date

Next:From: Michael FuhrDate: 2005-06-21 21:08:19
Subject: Re: Limit clause not using index
Previous:From: Paul RamseyDate: 2005-06-21 19:59:22
Subject: Re: Querying 19million records very slowly

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group