>- see footer for list info -< Tim, The data is not going to change during the few seconds it takes to render the page, thus there is no need to perform hundreds of queries. 1 query will do.
> -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Tim Blair > Sent: 10 January 2005 14:35 > To: Coldfusion Development > Subject: RE: [CF-Dev] Unlimited Hierarchy (recursive) > > >- see footer for list info -< > Lee, > > > Loop over it and build an explorer tree ( using list items > is probably > > the easiest method). Check if each item has child items, > if so add a > > nested list item. > > Depending on the potential size of the tree (length and > depth) this may not be the best way to go about it. For > every node you have to check if there are any child nodes; > this means that for a tree with 1000 nodes you have to do > 1000 queries. Not a good thing. Sure, caching can alleviate > the vast majority of this, but if the tree is changing > frequently then the cache can be irrelevant. > > This topic of conversation comes up again and again; you'll > find discussions to almost religious levels if you do a quick > search. One of the more often cited methods of handling > large trees in SQL is the "nested sets model". > > Using nested sets is a lot more complicated than the standard > "adjacency list" method (i.e. child-parent pairs) you've used > (especially if you're like me and are using an old version of > MySQL without sub-selects!) but it provides so much more > flexibility. Using a nested set model, I can pull out my > entire tree, including parent/child relationships and node > depths, with just a single query. > > Here's some links to more info about trees in SQL, including > discussion on why the adjacency list model is bad and nested > sets are good :) (at least for large trees): > > http://c2.com/cgi/wiki?TreeInSql > http://www.dbmsmag.com/9603d06.html > http://short.badpen.com/?RR0F83YD > > Of course, if the tree is small and the extra queries won't > really affect anything, then Russ' solution fits the bit perfectly. > > Tim. > > > -- > ------------------------------------------------------- > Badpen Tech - CF and web-tech: http://tech.badpen.com/ > ------------------------------------------------------- > RAWNET LTD - independent digital media agency > "We are big, we are funny and we are clever!" > New site launched at http://www.rawnet.com/ > ------------------------------------------------------- > This message may contain information which is legally > privileged and/or confidential. If you are not the intended > recipient, you are hereby notified that any unauthorised > disclosure, copying, distribution or use of this information > is strictly prohibited. Such notification notwithstanding, > any comments, opinions, information or conclusions expressed > in this message are those of the originator, not of rawnet > limited, unless otherwise explicitly and independently > indicated by an authorised representative of rawnet limited. > ------------------------------------------------------- > > _______________________________________________ > > For details on ALL mailing lists and for joining or leaving > lists, go to http://list.cfdeveloper.co.uk/mailman/listinfo > > -- > CFDeveloper Sponsors:- > >- Hosting provided by www.cfmxhosting.co.uk -< > >- Forum provided by www.fusetalk.com -< > >- DHTML Menus provided by www.APYCOM.com -< > >- Lists hosted by www.Gradwell.com -< > >- CFdeveloper is run by Russ Michaels, feel free to > volunteer your help > >-< > _______________________________________________ For details on ALL mailing lists and for joining or leaving lists, go to http://list.cfdeveloper.co.uk/mailman/listinfo -- CFDeveloper Sponsors:- >- Hosting provided by www.cfmxhosting.co.uk -< >- Forum provided by www.fusetalk.com -< >- DHTML Menus provided by www.APYCOM.com -< >- Lists hosted by www.Gradwell.com -< >- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<
