Closed jacobjove closed 9 months ago
It was actually written using ltree
in the past ;)
I also assumed it would be the best, but in practice ltree
is kind of neglected compared to other data types, so it did not benefit from better performance than just text
. And recently I found out that it is actually a lot faster and more powerful to use arrays of decimals, as we can insert new nodes between existing nodes without having to modify those nodes. And thanks to decimals, we can predict when we have no space left between nodes, unlike floats.
I'm actually curious to see if anybody came up with the same strategy, as it simplifies a lot the algorithm.
Oh, forgot to paste a reference to when it was using ltree
: https://github.com/BertrandBordage/django-tree/commit/c662be56f104c70d3edebd53fb7bd2be8a71ac21
Could it be beneficial for performance to (optionally?) use the native Postgress ltree data type?