Jump to content

[SOLVED] Adjacency vs nested sets: what are the other options


Recommended Posts

Hi,

I am in the designing part of creating a client server AJAX application. I will need to represent hierarchical data. I know there are two big schools of thought for representing such data: The adjacency model and the nested set.It's nightmarish to use adjacency with SQL because it's just awkward to code and gets complicated as the number of levels increase. Nested models is however very slow for trees where we will write because a lot of data needs to be moved around upon insertion. I know for a fact that my tree structure will be big and will have to be able to handle inserts gracefully. Does that condemn me to using the Adjacency model? In what I've read out there, there's always mention of a third option that would overcome the shortcomings of either method but I've never seen any sign of it. Anyone has a clue about that third method?

 

Can anyone php libraries for either method?

 

Thanks,

JR

Hi

 

Having similar thoughts about a major system change we will have to do soon.

 

If you are doing large amounts of inserts then you can space the number rangers out in the nested sets (ie, multiply the left and right amounts by 100), allowing you to do many inserts without having to individually update the right limits for each insert. Then just remove the spaces afterwards.

 

All the best

 

Keith

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.