#27260: Performance Issue because of LEFT OUTER JOIN instead the better INNER JOIN -------------------------------------+------------------------------------- Reporter: Sven R. Kunze | Owner: nobody Type: | Status: new Cleanup/optimization | Component: Database layer | Version: 1.8 (models, ORM) | Severity: Normal | Resolution: Keywords: | Triage Stage: | Unreviewed Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+-------------------------------------
Comment (by Sven R. Kunze): Replying to [comment:1 Tim Graham]: > Please also provide your models. {{{ class BigTable: # a lot of unrelated fields }}} {{{ class TableA: big_table = models.OneToOneField(BigTable, related_name='...', primary_key=True) item_id = models.CharField(max_length=1024) }}} {{{ class TableB: big_table = models.ForeignKey(BigTable, related_name='...') item_id = models.CharField(max_length=1024) }}} > I'm not certain whether or not your proposed changes are correct. If you can provide a patch so we can check whether or not it breaks existing behavior, it'll be more easily to evaluate the idea. Neither are we. Maybe, a {{{UNION}}} could also work. The real issue we have is the slow execution of the original query. -- Ticket URL: <https://code.djangoproject.com/ticket/27260#comment:2> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/065.e9a1f02cad8c1c13a756942aa28e8996%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.