Remix.run Logo
leeoniya 14 hours ago

storing the tree as an MPTT/NestedSet would massively simplify this, without any subquery shenanigans.

https://en.m.wikipedia.org/wiki/Nested_set_model

https://imrannazar.com/articles/modified-preorder-tree-trave...

jitl 11 hours ago | parent [-]

Well the read query has simpler syntax with MPTT but implementing the whole structure is more complicated and any re-organization like moving a folder around requires rewriting a lot of rows. Although it doesn’t apply to the Firefox use-case, I’ve never understood how this technique can be applied to anything but the most trivially sized, roughly immutable trees. What do you do in a production system when two people move two different node in the tree? It seems to need all kinds of complicated locks.