<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: When to use Stored Procedures</title>
	<atom:link href="http://www.pcpro.co.uk/blogs/2008/05/18/when-to-use-stored-procedures/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.pcpro.co.uk/blogs/2008/05/18/when-to-use-stored-procedures/</link>
	<description>Blogging in the real world</description>
	<lastBuildDate>Sun, 12 Feb 2012 15:02:20 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Logic Express 7 Mac</title>
		<link>http://www.pcpro.co.uk/blogs/2008/05/18/when-to-use-stored-procedures/comment-page-1/#comment-3693</link>
		<dc:creator>Logic Express 7 Mac</dc:creator>
		<pubDate>Mon, 21 Jul 2008 10:28:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.pcpro.co.uk/blogs/?p=699#comment-3693</guid>
		<description>&lt;strong&gt;Logic Express 7 Mac...&lt;/strong&gt;

An interesting post by a bloger made me......</description>
		<content:encoded><![CDATA[<p><strong>Logic Express 7 Mac&#8230;</strong></p>
<p>An interesting post by a bloger made me&#8230;&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Thought Dan</title>
		<link>http://www.pcpro.co.uk/blogs/2008/05/18/when-to-use-stored-procedures/comment-page-1/#comment-312</link>
		<dc:creator>Thought Dan</dc:creator>
		<pubDate>Mon, 19 May 2008 09:15:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.pcpro.co.uk/blogs/?p=699#comment-312</guid>
		<description>In my Thought Dan head I think I&#039;ll be using them more for actions in CMS Admin sections, where I have to do batch like queries in user functions.

I suppose it&#039;s balanced on how long does it take to write and what speed enhancement will it allow you.

Thought Dan : http://www.thoughtden.co.uk</description>
		<content:encoded><![CDATA[<p>In my Thought Dan head I think I&#8217;ll be using them more for actions in CMS Admin sections, where I have to do batch like queries in user functions.</p>
<p>I suppose it&#8217;s balanced on how long does it take to write and what speed enhancement will it allow you.</p>
<p>Thought Dan : <a href="http://www.thoughtden.co.uk" rel="nofollow">http://www.thoughtden.co.uk</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Wright</title>
		<link>http://www.pcpro.co.uk/blogs/2008/05/18/when-to-use-stored-procedures/comment-page-1/#comment-309</link>
		<dc:creator>David Wright</dc:creator>
		<pubDate>Mon, 19 May 2008 08:57:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.pcpro.co.uk/blogs/?p=699#comment-309</guid>
		<description>http://www.linuxjournal.com/article/9652

Linux Journal had an interesting feature on it.

The only point I didn&#039;t totally agree on was the &quot;Logic Fragmentation&quot;, where they said tracking errors was harder. I&#039;d say it makes it easier, in that the SP can be written, then a test harness written for the SP, tested to death, then, when it is finished, the resultant middle-tier class/routine can pick it up and run with it, in the knowledge that it is fully tested and working.

They are correct, in that you can&#039;t debug SQL using a debugger in the middle tier, but they drew the wrong conclusion, in my opinion. If the SQL has been compartmentalised and thoroughly tested, it means that the error is either in the class, or in the parameters it is trying to pass over - and if the stored procedure is checking the parameters and returning the appropriate error codes when they are incorrect, it should make tracking down the problem easier...

I agree, classes and encapsulation of business logic, and a central point for queries makes the need for SPs less of a requirement - although load-balancing across a server farm could be a reason to use them, if you have a dozen servers handling requests and shunting traffic back and forth, if they need to filter through a result set, performing logic on it, that pure SQL can&#039;t, then the network traffic between the load balancers and the database server(s) can be significant and breaking that logic out to a SP could significantly reduce load on the LBs and the internal network.

I think it is very much a case of looking at the size of the project, the number of predicted users, network traffic issues and number of client applications. Only once you have all of that information an you make a proper decision on whether SPs will be a benefit or not.

They aren&#039;t a universal panacea, but they shouldn&#039;t be dismissed out-of-hand.</description>
		<content:encoded><![CDATA[<p><a href="http://www.linuxjournal.com/article/9652" rel="nofollow">http://www.linuxjournal.com/article/9652</a></p>
<p>Linux Journal had an interesting feature on it.</p>
<p>The only point I didn&#8217;t totally agree on was the &#8220;Logic Fragmentation&#8221;, where they said tracking errors was harder. I&#8217;d say it makes it easier, in that the SP can be written, then a test harness written for the SP, tested to death, then, when it is finished, the resultant middle-tier class/routine can pick it up and run with it, in the knowledge that it is fully tested and working.</p>
<p>They are correct, in that you can&#8217;t debug SQL using a debugger in the middle tier, but they drew the wrong conclusion, in my opinion. If the SQL has been compartmentalised and thoroughly tested, it means that the error is either in the class, or in the parameters it is trying to pass over &#8211; and if the stored procedure is checking the parameters and returning the appropriate error codes when they are incorrect, it should make tracking down the problem easier&#8230;</p>
<p>I agree, classes and encapsulation of business logic, and a central point for queries makes the need for SPs less of a requirement &#8211; although load-balancing across a server farm could be a reason to use them, if you have a dozen servers handling requests and shunting traffic back and forth, if they need to filter through a result set, performing logic on it, that pure SQL can&#8217;t, then the network traffic between the load balancers and the database server(s) can be significant and breaking that logic out to a SP could significantly reduce load on the LBs and the internal network.</p>
<p>I think it is very much a case of looking at the size of the project, the number of predicted users, network traffic issues and number of client applications. Only once you have all of that information an you make a proper decision on whether SPs will be a benefit or not.</p>
<p>They aren&#8217;t a universal panacea, but they shouldn&#8217;t be dismissed out-of-hand.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kevin Partner</title>
		<link>http://www.pcpro.co.uk/blogs/2008/05/18/when-to-use-stored-procedures/comment-page-1/#comment-306</link>
		<dc:creator>Kevin Partner</dc:creator>
		<pubDate>Mon, 19 May 2008 08:14:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.pcpro.co.uk/blogs/?p=699#comment-306</guid>
		<description>I see what you&#039;re saying David: clearly the more sophisticated the application (and therefore the greater the number of database queries, the more developers and the greater their specialisation) the more this approach is of benefit. 

For smaller scale projects, many of these benefits can be achieved using good object design, of course, and I&#039;m as keen as you are on the black box approach because it means that once a class is working properly, it can then be left alone.

I&#039;m certainly going to take a look at MySQL&#039;s implementation. It&#039;s simply been a non-starter until now but the time has come to see how version 5 goes about it.</description>
		<content:encoded><![CDATA[<p>I see what you&#8217;re saying David: clearly the more sophisticated the application (and therefore the greater the number of database queries, the more developers and the greater their specialisation) the more this approach is of benefit. </p>
<p>For smaller scale projects, many of these benefits can be achieved using good object design, of course, and I&#8217;m as keen as you are on the black box approach because it means that once a class is working properly, it can then be left alone.</p>
<p>I&#8217;m certainly going to take a look at MySQL&#8217;s implementation. It&#8217;s simply been a non-starter until now but the time has come to see how version 5 goes about it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Wright</title>
		<link>http://www.pcpro.co.uk/blogs/2008/05/18/when-to-use-stored-procedures/comment-page-1/#comment-300</link>
		<dc:creator>David Wright</dc:creator>
		<pubDate>Mon, 19 May 2008 07:59:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.pcpro.co.uk/blogs/?p=699#comment-300</guid>
		<description>Stored procedures can be useful. It also makes a central point for accessing tables or queries. This means that, even if you have a db class PHP handler routine, you are not repeating SQL code throughout your application - and giving yourself more chances to forget to escape those strings.

Testing is also easier. You can test the SQL queries in isolation, knowing that they work 100% correctly. If you have code which is PHP calling a dynamic query, it can take more time trying to work out why the PHP code isn&#039;t working, when the culprit is the query.

Likewise, changes to the database require hunting through the code on the front-end(s) to find all instances where a table or field is used and altering them. If they call through stored procedure, you only need to change the query once and everything should still work - unless it is a radical change, the input parameters to the stored procedure shouldn&#039;t change and unless a field is removed from the output, no remedial action is immediately required on the front end code.

It also means that the front-end developers don&#039;t need to know SQL, and the database developer doesn&#039;t need to know PHP/ASP/Ruby/whatever. On a small team, or one-man-band, this isn&#039;t so important, but on a large project, it means that each developer can concentrate on their own area of expertise.

The anaylst defines which information needs to pass between the two layers, and as long as both development teams stick to the definitions, they never need to interfere with each other. The &quot;black box&quot; approach can remove a lot of headaches.</description>
		<content:encoded><![CDATA[<p>Stored procedures can be useful. It also makes a central point for accessing tables or queries. This means that, even if you have a db class PHP handler routine, you are not repeating SQL code throughout your application &#8211; and giving yourself more chances to forget to escape those strings.</p>
<p>Testing is also easier. You can test the SQL queries in isolation, knowing that they work 100% correctly. If you have code which is PHP calling a dynamic query, it can take more time trying to work out why the PHP code isn&#8217;t working, when the culprit is the query.</p>
<p>Likewise, changes to the database require hunting through the code on the front-end(s) to find all instances where a table or field is used and altering them. If they call through stored procedure, you only need to change the query once and everything should still work &#8211; unless it is a radical change, the input parameters to the stored procedure shouldn&#8217;t change and unless a field is removed from the output, no remedial action is immediately required on the front end code.</p>
<p>It also means that the front-end developers don&#8217;t need to know SQL, and the database developer doesn&#8217;t need to know PHP/ASP/Ruby/whatever. On a small team, or one-man-band, this isn&#8217;t so important, but on a large project, it means that each developer can concentrate on their own area of expertise.</p>
<p>The anaylst defines which information needs to pass between the two layers, and as long as both development teams stick to the definitions, they never need to interfere with each other. The &#8220;black box&#8221; approach can remove a lot of headaches.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

