<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Transcending Frontiers &#187; Storing Hierarchical Data in a Relational Database</title>
	<atom:link href="http://blog.thefrontiergroup.com.au/tag/trees/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.thefrontiergroup.com.au</link>
	<description>Your peek inside the collective mind of The Frontier Group</description>
	<lastBuildDate>Tue, 03 Jan 2012 06:53:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>Storing Hierarchical Data in a Relational Database</title>
		<link>http://blog.thefrontiergroup.com.au/2008/10/storing-hierarchical-data-in-a-relational-database/</link>
		<comments>http://blog.thefrontiergroup.com.au/2008/10/storing-hierarchical-data-in-a-relational-database/#comments</comments>
		<pubDate>Fri, 31 Oct 2008 02:25:07 +0000</pubDate>
		<dc:creator>Aaron</dc:creator>
				<category><![CDATA[Websites or Tools]]></category>
		<category><![CDATA[Adjacency List]]></category>
		<category><![CDATA[Nested Set]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[Trees]]></category>

		<guid isPermaLink="false">http://thefrontiergroup.com.au/blog/?p=117</guid>
		<description><![CDATA[In a previous job I dealt with the IT tasks related to a multi level marketing business. We stored everything in a database of course and due to the nature of multi level marketing most of the operations performed had to take into account the tree like structure of the people involved. An example would [...]]]></description>
			<content:encoded><![CDATA[<p>In a previous job I dealt with the IT tasks related to a multi level marketing business. We stored everything in a database of course and due to the nature of multi level marketing most of the operations performed had to take into account the tree like structure of the people involved.</p>
<p>An example would be, given a party that was run there would be rewards based on future bookings made, how much the party sold and so on. The largest direct benefitor of these rewards was of course the person that ran the party. However this person had a manager, who in turn may have a manager who in turn may have a manager and so on up the tree. At each level the manager got a cut based on a number of factors such as how many people she was managing, what her position was an so on.</p>
<p>At the time the way I dealt with trees was via <a href="http://en.wikipedia.org/wiki/Adjacency_list">adjacency lists</a>, mostly because that&#8217;s what was most logical to me and how it seemed everyone else did it. I thought I&#8217;d have a look around and see if anything had changed in the last couple of years and found <a href="http://dev.mysql.com/tech-resources/articles/hierarchical-data.html">this article</a> on using <a href="http://en.wikipedia.org/wiki/Nested_set_model">nested sets</a> to deal with hierarchical data.</p>
<p>It seems to me that this method trades insertion performance for selection performance which for most situations is fantastic! It seems to be exactly what I need given I&#8217;ll be performing far more selects than inserts and it also has given me another tool in my toolbox.</p>
<p>It&#8217;s long been understood that to keep someone in IT happy one of the most important things is change and new stuff. I think this constitutes new stuff for me.</p>
<script src="http://feeds.feedburner.com/~s/TranscendingFrontiers?i=http://blog.thefrontiergroup.com.au/2008/10/storing-hierarchical-data-in-a-relational-database/" type="text/javascript" charset="utf-8"></script>]]></content:encoded>
			<wfw:commentRss>http://blog.thefrontiergroup.com.au/2008/10/storing-hierarchical-data-in-a-relational-database/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

