<?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: Managing Hierarchical Data in MySQL</title>
	<atom:link href="http://www.vbmysql.com/articles/database-design/managing-hierarchical-data-in-mysql/feed" rel="self" type="application/rss+xml" />
	<link>http://www.vbmysql.com</link>
	<description>Just another WordPress site</description>
	<lastBuildDate>Fri, 07 Jan 2011 12:23:44 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: alex</title>
		<link>http://www.vbmysql.com/articles/database-design/managing-hierarchical-data-in-mysql#comment-1219</link>
		<dc:creator>alex</dc:creator>
		<pubDate>Fri, 07 May 2010 19:51:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.vbmysql.com/articles/database-design/managing-hierarchical-data-in-mysql/#comment-1219</guid>
		<description>I&#039;d like to talk more often to this page author.

many thanks and have a nice week-end!

alex</description>
		<content:encoded><![CDATA[<p>I&#8217;d like to talk more often to this page author.</p>
<p>many thanks and have a nice week-end!</p>
<p>alex</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jimmy Driesbach</title>
		<link>http://www.vbmysql.com/articles/database-design/managing-hierarchical-data-in-mysql#comment-1218</link>
		<dc:creator>Jimmy Driesbach</dc:creator>
		<pubDate>Sat, 24 Apr 2010 10:06:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.vbmysql.com/articles/database-design/managing-hierarchical-data-in-mysql/#comment-1218</guid>
		<description>Hey , I have just posted something comparable close to VBMySQL.com   &#187; Managing Hierarchical Data in MySQL on my journal yesterday morning. How smaller is the internet :)</description>
		<content:encoded><![CDATA[<p>Hey , I have just posted something comparable close to VBMySQL.com   &raquo; Managing Hierarchical Data in MySQL on my journal yesterday morning. How smaller is the internet <img src='http://www.vbmysql.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: letsnurture</title>
		<link>http://www.vbmysql.com/articles/database-design/managing-hierarchical-data-in-mysql#comment-1217</link>
		<dc:creator>letsnurture</dc:creator>
		<pubDate>Sun, 28 Mar 2010 14:53:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.vbmysql.com/articles/database-design/managing-hierarchical-data-in-mysql/#comment-1217</guid>
		<description>hi folks,


I&#039;m also belong to nested set model. I&#039;m working with tons of hierarchical data in the database and  i have decided to use the nested set model. But as Mukul told that traversal of node in nested set model is very expensive and so performance bottleneck.


So then i tried to find the nested set model with large gap. The above bottleneck is because of the integer that a node represent for left and right. So,if i keep the longer gap between these two terms then it may solve the problem.

Will anybody know about how to implement this kind of gap in nested set model ?

A little help is appreciated.

thanks in advance

Regards
Web-farmer
@Letsnurture</description>
		<content:encoded><![CDATA[<p>hi folks,</p>
<p>I&#8217;m also belong to nested set model. I&#8217;m working with tons of hierarchical data in the database and  i have decided to use the nested set model. But as Mukul told that traversal of node in nested set model is very expensive and so performance bottleneck.</p>
<p>So then i tried to find the nested set model with large gap. The above bottleneck is because of the integer that a node represent for left and right. So,if i keep the longer gap between these two terms then it may solve the problem.</p>
<p>Will anybody know about how to implement this kind of gap in nested set model ?</p>
<p>A little help is appreciated.</p>
<p>thanks in advance</p>
<p>Regards<br />
Web-farmer<br />
@Letsnurture</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mukul</title>
		<link>http://www.vbmysql.com/articles/database-design/managing-hierarchical-data-in-mysql#comment-1216</link>
		<dc:creator>mukul</dc:creator>
		<pubDate>Tue, 24 Mar 2009 17:40:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.vbmysql.com/articles/database-design/managing-hierarchical-data-in-mysql/#comment-1216</guid>
		<description>My concern is when we add or delete a node lot of updates happen.
i have around i million records under parent node.

i doubt about performance and integrity what if one wrong update happens</description>
		<content:encoded><![CDATA[<p>My concern is when we add or delete a node lot of updates happen.<br />
i have around i million records under parent node.</p>
<p>i doubt about performance and integrity what if one wrong update happens</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben</title>
		<link>http://www.vbmysql.com/articles/database-design/managing-hierarchical-data-in-mysql#comment-1215</link>
		<dc:creator>Ben</dc:creator>
		<pubDate>Wed, 25 Feb 2009 09:58:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.vbmysql.com/articles/database-design/managing-hierarchical-data-in-mysql/#comment-1215</guid>
		<description>@Steve

I don&#039;t know whether this page will help you...

http://www.ibase.ru/devinfo/DBMSTrees/sqltrees.html

If you go down to the bottom of the page, there&#039;s an algorithm that converts from adjacent to nested sets. I haven&#039;t used it myself, so I won&#039;t be shed any more light on it. I think it&#039;s designed to work with the example in that page, so if you follow that through it might shed some light on it!

Hope it helps.</description>
		<content:encoded><![CDATA[<p>@Steve</p>
<p>I don&#8217;t know whether this page will help you&#8230;</p>
<p><a href="http://www.ibase.ru/devinfo/DBMSTrees/sqltrees.html" rel="nofollow">http://www.ibase.ru/devinfo/DBMSTrees/sqltrees.html</a></p>
<p>If you go down to the bottom of the page, there&#8217;s an algorithm that converts from adjacent to nested sets. I haven&#8217;t used it myself, so I won&#8217;t be shed any more light on it. I think it&#8217;s designed to work with the example in that page, so if you follow that through it might shed some light on it!</p>
<p>Hope it helps.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://www.vbmysql.com/articles/database-design/managing-hierarchical-data-in-mysql#comment-1214</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Wed, 25 Feb 2009 09:39:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.vbmysql.com/articles/database-design/managing-hierarchical-data-in-mysql/#comment-1214</guid>
		<description>Very good article, explains nested sets well. The question I have though is if you initially have your data in an adjacent list (parentid, childid), how can you then convert this programatiicaly into a nested set table with appropriate lft and rgt values? ie, how do you get the nested set table in the first place without manually working out the lft and rgt values?</description>
		<content:encoded><![CDATA[<p>Very good article, explains nested sets well. The question I have though is if you initially have your data in an adjacent list (parentid, childid), how can you then convert this programatiicaly into a nested set table with appropriate lft and rgt values? ie, how do you get the nested set table in the first place without manually working out the lft and rgt values?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben</title>
		<link>http://www.vbmysql.com/articles/database-design/managing-hierarchical-data-in-mysql#comment-1213</link>
		<dc:creator>Ben</dc:creator>
		<pubDate>Thu, 29 Jan 2009 12:09:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.vbmysql.com/articles/database-design/managing-hierarchical-data-in-mysql/#comment-1213</guid>
		<description>This is a great article. I never would have thought that making a simple category/sub-category menu system would have been so complex.

Anyhow, I ran into an issue when adding a node. I try using the separate queries for adding nodes to nodes with no children, and adding nodes to nodes with children, and found that using the query that was designed to be used with childless nodes works for all cases, whereas the other seems to bump the node up the hierarchy regardless of where it&#039;s used.

It&#039;s no problem for me, but I thought it might save some head scratching for others!</description>
		<content:encoded><![CDATA[<p>This is a great article. I never would have thought that making a simple category/sub-category menu system would have been so complex.</p>
<p>Anyhow, I ran into an issue when adding a node. I try using the separate queries for adding nodes to nodes with no children, and adding nodes to nodes with children, and found that using the query that was designed to be used with childless nodes works for all cases, whereas the other seems to bump the node up the hierarchy regardless of where it&#8217;s used.</p>
<p>It&#8217;s no problem for me, but I thought it might save some head scratching for others!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike</title>
		<link>http://www.vbmysql.com/articles/database-design/managing-hierarchical-data-in-mysql#comment-1212</link>
		<dc:creator>Mike</dc:creator>
		<pubDate>Wed, 23 Apr 2008 18:19:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.vbmysql.com/articles/database-design/managing-hierarchical-data-in-mysql/#comment-1212</guid>
		<description>I may be completely wrong here.. but when building out your model I ran into an issue with finding a path if you delete categories. Mysql will not keep a running order for the auto-increment field and may place it in places to no become fragmented. The finding a path query doesnt seem to like that.. What I did was this

SELECT parent.name
FROM nested_category2 AS node,
        nested_category2 AS parent
WHERE node.lft BETWEEN parent.lft AND parent.rgt
        AND node.name = &#039;FLASH&#039;
ORDER BY parent.rgt DESC


I just did a different order by and it seems to be working</description>
		<content:encoded><![CDATA[<p>I may be completely wrong here.. but when building out your model I ran into an issue with finding a path if you delete categories. Mysql will not keep a running order for the auto-increment field and may place it in places to no become fragmented. The finding a path query doesnt seem to like that.. What I did was this</p>
<p>SELECT parent.name<br />
FROM nested_category2 AS node,<br />
        nested_category2 AS parent<br />
WHERE node.lft BETWEEN parent.lft AND parent.rgt<br />
        AND node.name = &#8216;FLASH&#8217;<br />
ORDER BY parent.rgt DESC</p>
<p>I just did a different order by and it seems to be working</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: josoroma</title>
		<link>http://www.vbmysql.com/articles/database-design/managing-hierarchical-data-in-mysql#comment-1211</link>
		<dc:creator>josoroma</dc:creator>
		<pubDate>Wed, 04 Jul 2007 19:27:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.vbmysql.com/articles/database-design/managing-hierarchical-data-in-mysql/#comment-1211</guid>
		<description>I was studying nested set model:
MySQL AB :: Managing Hierarchical Data in MySQL

Everything goes cool, because of my mysql version, now im having nightmares trying to pass the following subselect to joins, any help is welcome:


SELECT node.name, (COUNT(parent.name) - (sub_tree.depth + 1)) AS depth
FROM nested_category AS node,
nested_category AS parent,
nested_category AS sub_parent,
(
SELECT node.name, (COUNT(parent.name) - 1) AS depth
FROM nested_category AS node,
nested_category AS parent
WHERE node.lft BETWEEN parent.lft AND parent.rgt
AND node.name = &#039;PORTABLE ELECTRONICS&#039;
GROUP BY node.name
ORDER BY node.lft
)AS sub_tree
WHERE node.lft BETWEEN parent.lft AND parent.rgt
AND node.lft BETWEEN sub_parent.lft AND sub_parent.rgt
AND sub_parent.name = sub_tree.name
GROUP BY node.name
HAVING depth</description>
		<content:encoded><![CDATA[<p>I was studying nested set model:<br />
MySQL AB :: Managing Hierarchical Data in MySQL</p>
<p>Everything goes cool, because of my mysql version, now im having nightmares trying to pass the following subselect to joins, any help is welcome:</p>
<p>SELECT node.name, (COUNT(parent.name) &#8211; (sub_tree.depth + 1)) AS depth<br />
FROM nested_category AS node,<br />
nested_category AS parent,<br />
nested_category AS sub_parent,<br />
(<br />
SELECT node.name, (COUNT(parent.name) &#8211; 1) AS depth<br />
FROM nested_category AS node,<br />
nested_category AS parent<br />
WHERE node.lft BETWEEN parent.lft AND parent.rgt<br />
AND node.name = &#8216;PORTABLE ELECTRONICS&#8217;<br />
GROUP BY node.name<br />
ORDER BY node.lft<br />
)AS sub_tree<br />
WHERE node.lft BETWEEN parent.lft AND parent.rgt<br />
AND node.lft BETWEEN sub_parent.lft AND sub_parent.rgt<br />
AND sub_parent.name = sub_tree.name<br />
GROUP BY node.name<br />
HAVING depth</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rolf vreijdenberger</title>
		<link>http://www.vbmysql.com/articles/database-design/managing-hierarchical-data-in-mysql#comment-1210</link>
		<dc:creator>rolf vreijdenberger</dc:creator>
		<pubDate>Fri, 18 May 2007 23:14:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.vbmysql.com/articles/database-design/managing-hierarchical-data-in-mysql/#comment-1210</guid>
		<description>Hi Mike,

thanks for an excellent article ;)

I have been reading a lot of Celko&#039;s stuff also but the one thing that isn&#039;t really answered with concrete numbers is what happens with update times when your table grows very large.
Say we have a couple of million records and each time an insert is done on the table, we need to update roughly half the table on average with the new right values.
Any ideas about the performance hit on the table? especially when we&#039;re also doing lots of select operations from numerous clients at the same time...
It seems to me that this might really cripple the performance of a site using this system.

I&#039;m also very interested in benchmarks or speed estimates concerning the difference in nested sets that are very deep compared to nested sets that are very wide.

thanks for any input!

As I&#039;m trying to figure out what the best system might be for some sort of online &#039;create a million storylines&#039; application where anyone can create a story in a collaborative environment, but can pick up the story at any node, there is need for both quick selects and many updates. and with a potentially exponentially growing number of nodes, performance becomes an issue very rapidly. The architecture of this system is therefore of essential value to me.

If I find out anything usefull I will post back here, but in the mean time I&#039;m very curious of your thoughts or findings on this subject.</description>
		<content:encoded><![CDATA[<p>Hi Mike,</p>
<p>thanks for an excellent article <img src='http://www.vbmysql.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>I have been reading a lot of Celko&#8217;s stuff also but the one thing that isn&#8217;t really answered with concrete numbers is what happens with update times when your table grows very large.<br />
Say we have a couple of million records and each time an insert is done on the table, we need to update roughly half the table on average with the new right values.<br />
Any ideas about the performance hit on the table? especially when we&#8217;re also doing lots of select operations from numerous clients at the same time&#8230;<br />
It seems to me that this might really cripple the performance of a site using this system.</p>
<p>I&#8217;m also very interested in benchmarks or speed estimates concerning the difference in nested sets that are very deep compared to nested sets that are very wide.</p>
<p>thanks for any input!</p>
<p>As I&#8217;m trying to figure out what the best system might be for some sort of online &#8216;create a million storylines&#8217; application where anyone can create a story in a collaborative environment, but can pick up the story at any node, there is need for both quick selects and many updates. and with a potentially exponentially growing number of nodes, performance becomes an issue very rapidly. The architecture of this system is therefore of essential value to me.</p>
<p>If I find out anything usefull I will post back here, but in the mean time I&#8217;m very curious of your thoughts or findings on this subject.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

