Re: Why are stored procedures looked on so negatively? - Mailing list pgsql-general

From Kevin Goess
Subject Re: Why are stored procedures looked on so negatively?
Date
Msg-id CABZkbxgFTtawafBfb1cw4oBaN_f=Kx6yaATR-ek92Yh1TwDqhA@mail.gmail.com
Whole thread Raw
In response to Re: Why are stored procedures looked on so negatively?  (Adrian Klaver <adrian.klaver@gmail.com>)
List pgsql-general

On Tue, Jul 23, 2013 at 5:40 PM, Adrian Klaver <adrian.klaver@gmail.com> wrote:
On 07/23/2013 05:29 PM, Some Developer wrote:
I'm in the middle of building a database and was going to make extensive
use of stored procedures and trigger functions because it makes more
sense for the actions to happen at the database layer rather than in the
app layer.

Should I use them or not?

Personally I figure the arguments for and against are closely correlated with where on the development chain you are, and are tied in with job security. If you are an app developer than it is in your interest to have code in the app, if you are a database developer in the database. 

What he says is very true. But make sure to think about things that may already be set up to manage the application code: versioning, testing, unit testing, packaging, release process, and documentation--how much of that is in place for your stored procedures and triggers?  If a developer makes a change to application code, it gets checked in to source control, unit tested, code reviewed, goes through some QA, and is staged for the next roll to production--will that all happen for your stored procedures?  And consider, there is already logic in the application, now some of the logic will be in the application and some of it will be in the database--does it make sense to have it in two places?  

I think those are the kind of concerns that make people shy about putting too much logic in the database.  None of them are insurmountable, but you should at least think about them.

pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: Why are stored procedures looked on so negatively?
Next
From: John Meyer
Date:
Subject: Re: Why are stored procedures looked on so negatively?