by butonic · 5y ago · 0 comments
It’s one of the best books for data model design. Highly recommend.
I like paths for representing hierarchy, but closure tables can also be a good idea, depending on what you're modelling and how you query it.
But I still think it's useful to know the flattening idea. I've seen it show up other places like map reduce. It's a useful general idea imo.
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.