3 ms·
Trees in SQL
- newt0311 18y agovery cool. An interesting method for flattening trees.
- newsit 18y agoThe problem with the nested sets is that changing the tree can be slow. You need to update all the nodes with right/left pairs after the insertion/deletion point. There are two more methods which can be of interest and don't suffer from this problem: "Materialized path model" (which uses strings to encode the whole path to a node) and the "nested intervals tree encoding" (which could be the ideal solution if someone manages to implement it. I couldn't find a decent implementation): http://arxiv.org/ftp/cs/papers/0402/0402051.pdf http://arxiv.org/ftp/cs/papers/0402/0402051.pdf