Adhesion list tree using recursive WITH (Postgres 8.4) instead of nested set

I am looking for a Django tree library and doing my best to avoid nested sets (this is a nightmare to maintain).

The ends of the adjacency list model have always been unable to infer descendants without resorting to a few 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 suppose the Nested suite will still be faster, but as long as they are in the same complexity class, I could catch a 2x performance mismatch.

I'm interested in Django-Treebeard. Does anyone know if they made a WITH clause at startup in Postgres?

Has anyone here made the transition from nested sets in the light of the WITH clause?

+4
source share
2 answers

Here's another link comparing performance (but without a django link): http://explainextended.com/2009/09/24/adjacency-list-vs-nested-sets-postgresql/

List of attachments to nested sets: PostgreSQL (Quassnoi) Given the above and taking into account that nested model sets are much more difficult to manage, we can conclude that the adjacency list model should be used to manage hierarchical data in PostgreSQL 8.4.

+3
source

Some thoughts on the possibilities of this approach are here:

http://www.davidcramer.net/code/django/6939/scaling-threaded-comments-on-django-at-disqus.html

In short: David Kramer (django-debug-toolbar) really likes recursive queries and how they run for Disqus.

+1
source

Source: https://habr.com/ru/post/1299869/


All Articles