[geeks] Databases

joshua d boyd geeks at sunhelp.org
Sun Aug 26 21:20:00 CDT 2001


On Sun, Aug 26, 2001 at 08:13:04PM -0400, Ken Hansen wrote:
> MySQL is about to get perl stored procedures, but I don't see the need/use
> for such a thing - I've been on the DB sidelines since IBM DB/2 2.3 (8 or so
> years ago)...
> 
> Back then dynamic SQL was a big thing, and all teh good databases had
> triggers that could be written (to impose complex relationships, enforce
> data integrity, etc.)...
> 
> Why would I want stored procedures - this is an honest question, not a
> retorical one?

I could be off base, but...

When I've used them (mainly because a similar one was already written), I
was told that they would run faster on the server than downloading and
processing in VB could occur.

Further (and I am fairly sure of this), they save network
traffic.  For instance, if a regular SQL SELECT can only narrow the field
of records to return to 1 million, but you really only need 20, then the
stored procedure could do the work and only transmit the 20 needed.  But,
when I did stored procedures, they were run so rarely (maybe
monthly?) that it wasn't a significant savings.

So far, I really can't say.  Triggers are definately nice, and they are
somewhat related.

I supposed that in some systems stored procedures might be used with
custom datatypes.  But, I hope not.

In one case I came across, CGI scripts really where just a call to a
stored procedure.  A friend spent his summer writing these on
campus.  When asked why it was done that way instead of in perl, he had no
answer other than policy that he didn't control demanded it.  Bleh.


-- 
Joshua D. Boyd



More information about the geeks mailing list