#35442: N+1 queries from RelatedManager + only("pk")
-------------------------------------+-------------------------------------
Reporter: REGNIER Guillaume | Owner: nobody
Type: Uncategorized | Status: closed
Component: Database layer | Version: 4.2
(models, ORM) |
Severity: Normal | Resolution: duplicate
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 Simon Charette):
So I tried running the suite against the above patch and it delivered!
I was pointed at a single failure being `defer.tests.DeferTests.test_only`
{{{#!python
======================================================================
FAIL: test_only (defer.tests.DeferTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/charettes/Workspace/django/tests/defer/tests.py", line 52,
in test_only
self.assert_delayed(self.s1.primary_set.only("pk")[0], 2)
File "/Users/charettes/Workspace/django/tests/defer/tests.py", line 24,
in assert_delayed
self.assertEqual(count, num)
AssertionError: 3 != 2
}}}
What's interesting though is that
[https://github.com/django/django/commit/7f51876f99851fdc3fef63aecdfbcffa199c26b9
#diff-
51d1f447d95c1f21d5253801dc116988967499bafa107339257bcb58b2513e42L48-R47 it
might have a been a sneaky regression caused by the refactor to how field
deferral is implemented] that flew under the radar.
It was not discussed at all in the two PRs where #26207 was resolved
- https://github.com/django/django/pull/6118
- https://github.com/django/django/pull/6491
--
Ticket URL: <https://code.djangoproject.com/ticket/35442#comment:7>
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/0107018f64bb9b4f-f9edae9c-3593-4354-a22d-5f16eeb44652-000000%40eu-central-1.amazonses.com.