Re:Hierarchical Structures in PostgreSQL (2020)
by vore on Friday June 25, 2021 @05:03PM
(#27636255)
This is use case dependent, but one of my favorite methods for implementing e.g. threaded comments is closure tables:
At the cost of O(n^2) rows per hierarchy, it will allow you to do some pretty nifty things, most notably being able to get a count of all descendants of a parent in O(n) time. Updating entries may be painful, though.
[ Parent
| on HN ]
There are no comments on this comment yet.