I\'m considering using PostgreSQL\'s Ltree module in my application to help with threaded comments. I\'ve been eying it for a while to use for threaded comments. I figure it w
I recommend anyone implementing hierarchical relationships in SQL read Joe Celko's Trees and Hierarchies in SQL for Smarties.
Traversing arbitrary depth parent child links can be very inefficient when using just a parent_id. The book describes techniques that make this access fast.
One strategy (which I happen to use) can also be found for free in this series of articles: