A
A
Andrey2016-05-03 19:22:06
PostgreSQL
Andrey, 2016-05-03 19:22:06

How to make a Django + PostgreSQL recursive query?

Hello!
There is a model:

class Task(models.Model):
    title = models.CharField()
    relates_to = models.ForeignKey('self')

Is it possible to get the chain with a single request?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Kitaev, 2016-05-03
@deliro

Might be worth considering MPTT ( django-mptt ). Natively, without crutches, without recursions, the fastest read requests, a subtree with 12 levels and 4 sons for each internal node, is obtained in one request (instead of 5.5 million requests).
Of the minuses - a long time to record.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question