Choosing a database model for a hierarchical content –

You’re probably familiar with multi-level comments sections such as on Reddit, or Hackernews — a user can reply to a post, and the system allows multiple levels of nested replies. I recently needed to implement it, and found a few ways of modelling the database, with different complexities and tradeoffs. In this article, I will cover a few of them.