4 ms·
The idea behind the article is simple - use the structures fit for the problem. The narrative, though, is imho faulty. You dont need CTE to retrieve the tree f
by kroolik 3y ago
The idea behind the article is simple - use the structures fit for the problem.
The narrative, though, is imho faulty. You dont need CTE to retrieve the tree from the db - you can fetch a flat list and construct the tree locally, as you would most likely need to anyway for following manipulations.
The very same argument can be made about people who use rdbms to store the list - store it in a text file. Why pay the network latency cost?
Or alternatively, the proposed structure would not work with sufficiently big tree if we wanted to move branches around, changing their depth. That would impose linear cost.
State your intention at the beginning, instead of explaining three different examples that are later on invalidated in the conclusion section with "if you need a tree, use a tree". But adding this to the beginning of the article would be way less clickbaity.