No support for UNION (OUTER JOIN instead)

92 views
Skip to first unread message

guettli

unread,
Mar 13, 2017, 11:54:15 AM3/13/17
to Django users

We have performance issues on postgres because some SQL statements have up to six LEFT OUTER joins.


Union and intersection would be easier to read for me (human being) and maybe better to optimize for the postgres query planer.

It seems that other people have this issue, too: https://code.djangoproject.com/ticket/27260

The above ticket was closed with a comment to ask for help on the support channels. That's why I wrote here.

Have other developers seen performance issues because the SQL had a lot of LEFT OUTER joins?

Is there a work-around?

Regards,
  Thomas Güttelr

Tim Graham

unread,
Mar 13, 2017, 12:00:17 PM3/13/17
to Django users
Support for QuerySet.union(), intersection(), and difference() is added in Django 1.11.

https://github.com/django/django/commit/84c1826ded17b2d74f66717fb745fc36e37949fd

guettli

unread,
Mar 14, 2017, 5:37:07 AM3/14/17
to Django users
Great, you and the django dev team are fast than light. Every time I spot a basic missing part, you have already solved it in the next release.

guettli

unread,
Mar 15, 2017, 5:44:22 AM3/15/17
to Django users

Just for the records, I added your work-around (until Django 1.11) to as comment on the issue tracker.

guettli

unread,
Mar 24, 2017, 7:32:55 AM3/24/17
to Django users
Just for the records. If you think further, then deprecating is_superuser, is_staff and is_active could be a solution. See: https://groups.google.com/forum/#!topic/django-developers/J9yttc7WmJU
Reply all
Reply to author
Forward
0 new messages