|
|
|
|
|
by andrewstuart2
1322 days ago
|
|
Have you tried recursive CTEs with a simple id, parent_id etc schema? These should perform very well if those columns are in an index. Afaik this is pretty much the canonical way to store recursive comment trees. Or any kind of DAG. |
|
Storing a pointer to each node’s parent or using sorted sets seems like it would make the parent poster’s query slower. Those approaches would make it easier to reparent comments, though, and they’d support arbitrarily deep trees (whereas the materialized path implementations I’ve seen limit path length).