3 ms·
For the amount of data it processes it can be slow. I used it to render a category taxonomy of just maybe 100 nodes and it was a perceptible duration. The repre
by karmakaze 9y ago
For the amount of data it processes it can be slow. I used it to render a category taxonomy of just maybe 100 nodes and it was a perceptible duration. The representation was so direct and clear that I kept it and just cached it server-side I validating went any category was changed. Also had to ensure there were no cycles in the data when saving changes.
- agentultra 9y agoFor some kinds of data, such as taxonomies, there is a datatype called an ltree available in Postgres that can be indexed. Not as general as a CTE but useful for avoiding the optimization barrier in specific cases.
- karmakaze 9y agoIt's always to learn about new things in areas you already thought you'd covered. I'll definitely look this up. Another common issue I've encountered is with representing reorderable items. I've usually just amortized a partial renumbering that works well enough but always wondered if there's a better way. Would storing balanced trees and using a recursive CTE work as well and be a bit simpler?
- agentultra 8y agoRe-orderable items are best represented using a rational. There is a great blog post on the different approaches and trade-offs of user-orderable items[0]. [0] https://begriffs.com/posts/2018-03-20-user-defined-order.html https://begriffs.com/posts/2018-03-20-user-defined-order.htm...