News for hackers. Stuff that matters.
Re:Hierarchical Structures in PostgreSQL (2020) by nlehuen on Saturday June 26, 2021 @03:02AM (#27639789)
I'm a big fan of the nested set representation. It hits the sweet spot of compactness and expressivity - queries for parents, children, ancestors and descendants are simple integer comparison and pretty fast with the right indices.

The only downside is that this requires updates of a large number of rows whenever the tree changes (not all rows though). If you have a sharded table that could be problematic.

There are no comments on this comment yet.