3 ms·
For 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 fo
by agentultra 8y ago
For 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 8y 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...