During the development of our latest product, we have to store a set of data in a tree structure. Usually we would implement the tree in nested set, if we found that we usually fetch the tree but not update the tree. Nested Set structure would have a bigger overhead if we do update on the tree but it is excellent in fetching, the main reason is that when we do update on the tree, we would index the entire tree again.
What is Nested Set?
Nested Set is a hierarchical data structure that store your data as a tree in the database. For more detail, you could go here http://dev.mysql.com/tech-resources/articles/hierarchical-data.html
Nested Set Plugin for RoR
We have implemented Nested Set in many projects, we make use of plugin, which give us handy functions to manipulate our “tree”. We used old plugin acts_as_nested_set, and then use better_nested_set (which is to replace the old one).
These day when we work on our latest project, we found that there is a latest plugin named awesome_nested_set, which is to replace all its previous version.
We just wonder will there be any “amazing_nested_set” or “it_is_really_fuking_amazing_nested_set” later on. =p
btw, this plugin is really awesome.
Leave a reply