Adjacency List Tree Using Recursive WITH (Postgres 8.4) instead of Nested Set
Posted
by Koobz
on Stack Overflow
See other posts from Stack Overflow
or by Koobz
Published on 2010-01-31T10:53:47Z
Indexed on
2010/06/15
4:02 UTC
Read the original article
Hit count: 409
I'm looking for a Django tree library and doing my best to avoid Nested Sets (they're a nightmare to maintain).
The cons of the adjacency list model have always been an inability to fetch descendants without resorting to multiple queries. The WITH clause in Postgres seems like a solid solution to this problem.
Has anyone seen any performance reports regarding WITH vs. Nested Set? I assume the Nested set will still be faster but as long as they're in the same complexity class, I could swallow a 2x performance discrepancy.
Django-Treebeard interests me. Does anyone know if they've implemented the WITH clause when running under Postgres?
Has anyone here made the switch away from Nested Sets in light of the WITH clause?
© Stack Overflow or respective owner