Evaluate replacing MPTT with PostgreSQL ltree #11421
Labels
status: accepted
This issue has been accepted for implementation
type: housekeeping
Changes to the application which do not directly impact the end user
Proposed Changes
The recent loss of maintainership for django-mptt, has precipitated discussion on evaluating a replacement for our usage of MPTT for hierarchical models with an alternate solution. CTE has been discussed, see #6587
Author of django-tree-queries lists his reasons here: https://406.ch/writing/django-tree-queries/. He notes potential issues he doesn't like with PostgreSQL ltree, however this is probably still a viable alternative. See https://github.com/mariocesar/django-ltree and https://github.com/peopledoc/django-ltree-demo (the ltree-demo could just be pulled into the app and updated, i.e. not use any library). Potentially easier to implement the equivalent of add_related_count()...
Justification
MPTT has serves us pretty well, however it comes with some limitations, notably the need to consistently rebuild the tree with every change. This imposes some additional overhead around things like bulk updates. MPTT also requires a set of database fields to maintain the tree: tree_id, level, lft (left), and rght (right). There are also a handful of issues blocked by us making a decision on this issue.
The text was updated successfully, but these errors were encountered: