title: SQL hierarchyid depth first vs breadth first: using one over the other?
body: <p>I know about <code>Breadth First Search</code> and <code>Depth First Search</code>. I read <a href="http://www.sqlservercentral.com/articles/SQL+Server+2008/62204/" rel="nofollow noreferrer">this page</a>, and also on SO, I found <a href="https://stackoverflow.com/questions/687731/breadth-first-vs-depth-first">this question</a> and <a href="https://stackoverflow.com/questions/1657174/what-is-breadth-first-search-useful-for">this question</a> too.</p>
  
  <p>What I wanna know is some practical scenerio where I would use depth first over breadth search. Though I third question link I provided is kinda similar, my question is more geared toward <code>t-sql</code> and <code>SQL Server 2008/2012</code> performance.</p>
  
  <p>Also, if I use one over other can anyone show me an example how much (worst case scenario) performance impact can I have? Say, if I adopt a <code>dfs</code>, and I have 50 children in first node, and I am searching for 2nd node, the <code>dfs</code> would be about 50 times slow from what I can think, because it would first have to transverse 50 children then it will come to second node. Is this so or not? I mean is it just like this direct relation btw the performance or otherwise?</p>
  
  <p>Lastly, to repeat my question again, although it may (most likely will be) application and requirement specific, I would like to know some practical scenario where I would use one over the other, and what might be the performance cost of choosing one over the other? Also, I am am maintain a category catalog what should I choose? Say, I am maintaining a books category catalog something like : <code>science =&gt; physics =&gt; astronomy</code> and so on, which one would be the best? <code>dfs</code> or <code>bfs</code>?</p>