-
Notifications
You must be signed in to change notification settings - Fork 461
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question about efficiency #60
Comments
Nested Sets are generally for hierarchical data like categories. If you don't need your tags to be hierarchical, then Nested Sets are probably over kill. If you do need to get the data in it's hierarchical fashion (as a tree for categories for example) then nested sets (in my opinion) are the best way to go. Especially if the hard work is done as it is with this project. There are easier ways to manage tags owned by different organisations as long as you don't need them to have parents or children. Look up Many to Many relationships (http://laravel.com/docs/eloquent#many-to-many) using a pivot table. |
@SiCoUK answered your question pretty well here. A nested set implementation is usually pretty fast when querying hierarchy chains (ascendants, descendants), and slow when performing inserts/updates because of the index bounds re-computation. So, NestedSet structures are good when your use-case requires hierarchical structures which are queried far more often than modified (inserted/updated). Also as @SiCoUK said, if your tag data implementation does not need to be hierarchical there's no need to use a nested set structure for that. |
I think your question has been answered so I'm closing this issue for now. Please, feel free to reopen or open a new issue if you've got more questions. |
Hey,
First of all, great project, thanks for building it.
I was reading the theory behind nested sets which states
My use case is tags. Organisations have many tags, which they can use to tag other models that they own (e.g. assets). This seems similar to your categories example. However, unlike categories of which there may only be a small amount (say for a shop), there could be a lot of tags in that table. Everyone's tags from across the whole product, but they would only own / be able to access a subset of those. It would be possible that this table could get big, and I'm worried about the intensity of those rewrites that have to occur.
Any thoughts?
The text was updated successfully, but these errors were encountered: