<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://weblogs.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Which is better in SQL Server: Recursion or Temp tables?</title><link>http://weblogs.asp.net/krobertson/archive/2004/03/09/86900.aspx</link><description>I have a little dilemma. For nGallery, we want to update it so the &amp;#8220;picture count&amp;#8221; returns the number of pictures in the album and all of its subalbums, not just in that one album. One thing that complicates it is that you can have subsubalbums</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>re: Which is better in SQL Server: Recursion or Temp tables?</title><link>http://weblogs.asp.net/krobertson/archive/2004/03/09/86900.aspx#7236543</link><pubDate>Fri, 23 Oct 2009 00:54:03 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7236543</guid><dc:creator>Daddy53</dc:creator><author>Daddy53</author><description>&lt;p&gt;Ottawa Tribe of Oklahoma v. , &lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7236543" width="1" height="1"&gt;</description></item><item><title>re: Which is better in SQL Server: Recursion or Temp tables?</title><link>http://weblogs.asp.net/krobertson/archive/2004/03/09/86900.aspx#6621166</link><pubDate>Fri, 12 Sep 2008 19:01:38 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6621166</guid><dc:creator>marklar</dc:creator><author>marklar</author><description>&lt;p&gt;woops nested set. &amp;nbsp;no edit.&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6621166" width="1" height="1"&gt;</description></item><item><title>re: Which is better in SQL Server: Recursion or Temp tables?</title><link>http://weblogs.asp.net/krobertson/archive/2004/03/09/86900.aspx#6621160</link><pubDate>Fri, 12 Sep 2008 18:58:22 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6621160</guid><dc:creator>marklar</dc:creator><author>marklar</author><description>&lt;p&gt;replace the entire tree with a cached scalar table! sounds processor intensive. &amp;nbsp;(in reply to modifying celko's adjacency list design)&lt;/p&gt;
&lt;p&gt;recursion is limited to 32 levels, but alot of hierarchies don't exceed this extent.&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6621160" width="1" height="1"&gt;</description></item><item><title>re: Which is better in SQL Server: Recursion or Temp tables?</title><link>http://weblogs.asp.net/krobertson/archive/2004/03/09/86900.aspx#154618</link><pubDate>Sun, 13 Jun 2004 14:17:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:154618</guid><dc:creator>s</dc:creator><author>s</author><description>s&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=154618" width="1" height="1"&gt;</description></item><item><title>re: Which is better in SQL Server: Recursion or Temp tables?</title><link>http://weblogs.asp.net/krobertson/archive/2004/03/09/86900.aspx#142985</link><pubDate>Thu, 27 May 2004 12:06:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:142985</guid><dc:creator>rajgangina</dc:creator><author>rajgangina</author><description>USe Temptable it is better&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=142985" width="1" height="1"&gt;</description></item><item><title>Hierarchy structural data challenge</title><link>http://weblogs.asp.net/krobertson/archive/2004/03/09/86900.aspx#121338</link><pubDate>Tue, 27 Apr 2004 23:01:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:121338</guid><dc:creator>TrackBack</dc:creator><author>TrackBack</author><description>&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=121338" width="1" height="1"&gt;</description></item><item><title>Hierarchy structural data challenge</title><link>http://weblogs.asp.net/krobertson/archive/2004/03/09/86900.aspx#121326</link><pubDate>Tue, 27 Apr 2004 22:56:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:121326</guid><dc:creator>TrackBack</dc:creator><author>TrackBack</author><description>&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=121326" width="1" height="1"&gt;</description></item><item><title>re: Which is better in SQL Server: Recursion or Temp tables?</title><link>http://weblogs.asp.net/krobertson/archive/2004/03/09/86900.aspx#111021</link><pubDate>Sat, 10 Apr 2004 23:45:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:111021</guid><dc:creator>Sky</dc:creator><author>Sky</author><description>I came across your question via Ken Robertson's blog page at &lt;a target="_new" href="http://weblogs.asp.net/jezell/archive/2004/03/10/87010.aspx#111012"&gt;http://weblogs.asp.net/jezell/archive/2004/03/10/87010.aspx#111012&lt;/a&gt; where I posted a summary of the different techniques that I have come across for dealing with recursion. Since you mentioned Celko's, thought I might post that there is a variation known as Farrady(sp?) Fractals. Looks interesting since it solves some of the update mess of Celko's.&lt;br&gt;&lt;br&gt;Cheers!&lt;br&gt;&lt;br&gt;PS: Celko's solution was a bit of a downer for me. At first blush it looked great. But then realized it is best suited for FEW updates: I've clocked sqlserver doing about 1000 straight updates per second, and for a decent tree, that's not very many nodes... -- and don't forget that you have to freeze the whole table for the update -- effectively blocking out usage of it until done. &lt;br&gt;&lt;br&gt;Then again, as I write this, it just dawned on me that that one could do that in a temp table, and then replace the original, although I didn't try that when I was messing around with the theory. Hum. Maybe it aint so bad after all !&lt;br&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=111021" width="1" height="1"&gt;</description></item><item><title>Table-Valued Function for traversing a tree</title><link>http://weblogs.asp.net/krobertson/archive/2004/03/09/86900.aspx#93170</link><pubDate>Sat, 20 Mar 2004 15:46:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:93170</guid><dc:creator>TrackBack</dc:creator><author>TrackBack</author><description>&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=93170" width="1" height="1"&gt;</description></item><item><title>Excellent read on hierachy trees in SQL!</title><link>http://weblogs.asp.net/krobertson/archive/2004/03/09/86900.aspx#87414</link><pubDate>Wed, 10 Mar 2004 22:04:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:87414</guid><dc:creator>TrackBack</dc:creator><author>TrackBack</author><description>&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=87414" width="1" height="1"&gt;</description></item></channel></rss>