NYCPHP Meetup

NYPHP.org

[nycphp-talk] SPROCs in the MySQL/PostgreSQL + PHP crowd

Rob Marscher rmarscher at beaffinitive.com
Wed Nov 10 16:37:51 EST 2010


On Nov 10, 2010, at 3:31 PM, Jerry B. Altzman wrote:
> I know that in the commercial database world use of stored procedures is The Way Things Are Pretty Much Done, but I've not seen it in my brief forays through the bulk of PHP code I've examined (and needless to say, written). Am I just out of it? Is it just not considered usual practice, or am I blind?

Personally, I think stored procedures are useful when you have DBAs in control of the database and critical business logic and they don't trust the developers interacting with the data.  Also useful if you have several different codebases acting on the data.  A lot of php code is done with the least common denominator in mind (i.e. somebody on a free shared hosting account), so it won't take advantage of the advanced tools available (non-default extensions, db features that require more recent versions of mysql [although most are probably on 5.0+ now], etc).

However, if you do essentially have one codebase doing all of your data manipulation and you don't have dedicated DBAs, I think using stored procedures doesn't really make sense because it's dividing up where your business logic is located and potentially making things more confusing or harder to debug.




More information about the talk mailing list