Answer the question
In order to leave comments, you need to log in
What is the best tree structure for implementing multi-level comments and why?
Hello everybody. There is a task to implement a system of multi-level comments (on the news portal) on Django, I would like to know which tree structure is best suited and why?
I singled out three structures for myself:
1) Adjacency model
2) Nested Sets
3) Closure Table.
What is better to choose for the task described by me above?
I want to note right away that the availability of ready-made solutions is not a big plus for me.
Answer the question
In order to leave comments, you need to log in
MPTT. Because:
1) There is a django-mptt package that already has everything
2) Almost all the selections that come to your mind are made in one request.
MPTT is an extension of nested sets. Of the minuses, everything is the same as in nested sets - non-compliance with referential integrity, heavy insert
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question