Re: Reason(s) not to use a stored procedure

From: Nick Nick <nick7535(at)hotmail(dot)com>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Reason(s) not to use a stored procedure
Date: 2008-01-22 15:23:41
Message-ID: BAY131-W13D4D620801CC7257BDAB7C43E0@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice


A. Kretschmer wrote:
> am Tue, dem 22.01.2008, um 8:49:39 -0500 mailte Mag Gam folgendes:
>> I was in an academic meeting where a professor was preaching the reasons why
>> not to use a stored procedure. He advised to always use SQL instead of a
>> procedural language. Can someone please shed some light on this?
>
> Why not use procedural languages? He told more about the reasons?
>

I assume that it is true for PostgreSQL as it was for Oracle that it is
less costly (in terms of computer resources) to select and filter data
at the RDBMS level with a single SQL call than at a higher level that
may involve more calls to the RDBMS. That will be even more true if
there's a network in between.

So if you can do something in SQL, that is likely to be the most
efficient way to do it (assuming optimally written code and indexes and
whatever).

But in the real world some things you might want to do may require such
contorted SQL (or may not even be possible in SQL at all) whereas using
a procedure would be simpler to write, understand (important for when it
needs to be revisited in a year's time and by someone else) and
maintain, and you might be able to make it perform better (if needed -
why bust a gut and waste money shaving a few minutes off a nightly run
when there's nobody there to see it finish anyway?).

Maybe the professor just sat in his ivory tower without a foot in the
real world, or hadn't seen it since the early 90s?

If you're doing a real-world job just do a real-world solution!

Nick.

_________________________________________________________________
Share what Santa brought you
https://www.mycooluncool.com

Browse pgsql-novice by date

  From Date Subject
Next Message Christoph Frick 2008-01-22 15:29:20 Re: Reason(s) not to use a stored procedure
Previous Message A. Kretschmer 2008-01-22 14:33:56 Re: Reason(s) not to use a stored procedure