Representing Trees in PostgreSQL
woss.name
Representing Trees in PostgreSQL
1–10 of 60 posts
Re: Representing Trees in PostgreSQL
#2Re: Representing Trees in PostgreSQL
#3Adjacency lists also don't perform that badly with recursive queries in my experience.
Re: Representing Trees in PostgreSQL
#4Re: Representing Trees in PostgreSQL
#5Implement a view helper to take the flat data and return a hierarchical structure that you can render.
Re: Representing Trees in PostgreSQL
#6Compared to a mysql with nested set postgres using with recursive is a life changer :D
Re: Representing Trees in PostgreSQL
#7Namely using the && operator let's you make use of indices on the materialized paths. We've been using it in production for years to great effect.
Re: Representing Trees in PostgreSQL
#8Re: Representing Trees in PostgreSQL
#91
1.1
1.2
2
2.1
2.1.1
2.1.2
2.1.2.1
In this way, displaying comments in a tree form is trivial. Just ORDER BY the sort key. I find it brilliant for applying to such an application.
Re: Representing Trees in PostgreSQL
#10> We could have retrieved all the appropriate data with a single query, but that means reconstructing the tree from a flat set of rows we got back from PostgreSQL. Doing that sort of thing in the view would be hienous. Implement a view helper to take the flat data and return a hierarchical structure that you can render.