<?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>The Site for VB and MySQL</description>
	<lastBuildDate>Tue, 09 Mar 2010 05:39:21 -0800</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.3</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: mukul</title>
		<link>http://www.vbmysql.com/articles/database-design/managing-hierarchical-data-in-mysql/comment-page-1#comment-24950</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-24950</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-page-1#comment-24059</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-24059</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-page-1#comment-24058</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-24058</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-page-1#comment-23183</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-23183</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-page-1#comment-16257</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-16257</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-page-1#comment-7958</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-7958</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-page-1#comment-4763</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-4763</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/wordpress/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>
	<item>
		<title>By: Cammy</title>
		<link>http://www.vbmysql.com/articles/database-design/managing-hierarchical-data-in-mysql/comment-page-1#comment-4266</link>
		<dc:creator>Cammy</dc:creator>
		<pubDate>Tue, 08 May 2007 18:14:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.vbmysql.com/articles/database-design/managing-hierarchical-data-in-mysql/#comment-4266</guid>
		<description>Hi Mike

Thanks for the reply.
I hacked through it a bit as I am new to MySQL but it&#039;s working now.</description>
		<content:encoded><![CDATA[<p>Hi Mike</p>
<p>Thanks for the reply.<br />
I hacked through it a bit as I am new to MySQL but it&#8217;s working now.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike Hillyer</title>
		<link>http://www.vbmysql.com/articles/database-design/managing-hierarchical-data-in-mysql/comment-page-1#comment-4263</link>
		<dc:creator>Mike Hillyer</dc:creator>
		<pubDate>Tue, 08 May 2007 16:48:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.vbmysql.com/articles/database-design/managing-hierarchical-data-in-mysql/#comment-4263</guid>
		<description>This generally means that the &#039; &#039; in your query is not in the same charset as the content of the column. Cast one or the other to match.</description>
		<content:encoded><![CDATA[<p>This generally means that the &#8216; &#8216; in your query is not in the same charset as the content of the column. Cast one or the other to match.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cammy</title>
		<link>http://www.vbmysql.com/articles/database-design/managing-hierarchical-data-in-mysql/comment-page-1#comment-4240</link>
		<dc:creator>Cammy</dc:creator>
		<pubDate>Tue, 08 May 2007 06:50:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.vbmysql.com/articles/database-design/managing-hierarchical-data-in-mysql/#comment-4240</guid>
		<description>Hi,

When I execute your indentation query on your &#039;Finding the depths of the nodes&#039; section, I get the following error message:

Illegal mix of collations (utf8_general_ci,COERCIBLE) and (latin1_swedish_ci,IMPLICIT) for operation &#039;concat&#039;

Can you help me? I think the problems lies with the REPEAT function because if you remove it, the query executes (but the result is of-course not what we are trying to get.)

Thank You.</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>When I execute your indentation query on your &#8216;Finding the depths of the nodes&#8217; section, I get the following error message:</p>
<p>Illegal mix of collations (utf8_general_ci,COERCIBLE) and (latin1_swedish_ci,IMPLICIT) for operation &#8216;concat&#8217;</p>
<p>Can you help me? I think the problems lies with the REPEAT function because if you remove it, the query executes (but the result is of-course not what we are trying to get.)</p>
<p>Thank You.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
