Re: Organisational question: surely someone has implemented many Boolean values (tags) and a solution exist

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 21 January 2011 05:34, Paul M Foster <paulf@xxxxxxxxxxxxxxxxx> wrote:
> On Thu, Jan 20, 2011 at 12:05:53PM -0800, David Harkness wrote:
>
>> On Thu, Jan 20, 2011 at 7:00 AM, Richard Quadling <rquadling@xxxxxxxxx>wrote:
>>
>> > I'd recommend using a nested set approach for the tags
>> > (http://dev.mysql.com/tech-resources/articles/hierarchical-data.html
>> > gives a good explanation on the issues and methodology of nested
>> > sets).
>> >
>>
>> Thanks for the link. That article proposes an interesting way to organize
>> the categories. Have you implemented this in the wild? Clearly the design
>> would work as it's pretty simple, and I like that it removes the need for
>> recursive queries.
>>
>> Dotan, the Venn diagrams are just used to explain the concept. If you use
>> the code to determine the left and right values, you can ignore the diagrams
>> entirely. As long as you're not adding/removing categories every minute,
>> having to recalculate left and right values isn't that big of a deal.
>
> For the curious, here is a different article which explains the same
> concept:
>
> http://articles.sitepoint.com/article/hierarchical-data-database
>
> Paul

Nice article. Sitepoint has a lot of useful articles.

And as the conclusion says ...

"You're now familiar with both ways to store trees in a database.
While I have a slight preference for the modified preorder tree
traversal, in your particular situation the adjacency list method
might be better. I'll leave that to your own judgement."

So, basically, Dotan, you have to do some analysis to determine which
solution is best for you. But as soon as you say "multiple levels" I
think nested sets. If you are going to enforce just 1 or 2 levels,
then MAYBE adjacent list is the way for you.

Richard.

-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux