#27833: prefetch_related fails with SQLite when used with 1000 parent records
-------------------------------------+-------------------------------------
Reporter: Jason Barnabe | Owner: (none)
Type: Bug | Status: new
Component: Database layer | Version: 1.10
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Simon Charette):
* owner: Yashas Donthi => (none)
* status: assigned => new
Comment:
Two notes worth of mention here.
1. In the case of records referenced through multiple fields (e.g.
`ForeignObject(from_felds, to_fields)` where more than one field is
involved) then the problem can manifest itself with `(1000 / len(fields))
+ 1` records as SQLite doesn't support tuple comparison and thus must
expand `(field0, ..., fieldN) IN %s` into `(field0 = v0_0 ..., fieldN =
vn_0) ... OR ... (field0 = v0_m ..., fieldN = vn_m)`. See #36116 where
this was uncovered.
2. Now that we changed the prefetching interface from
`get_prefetch_queryset` to `get_prefetch_querysets` in #33651 it paves the
way for prefetcher implementations to be adapted to slice `instances`
based on `connection.ops.bulk_batch_size` which makes solving this ticket
way easier.
--
Ticket URL: <https://code.djangoproject.com/ticket/27833#comment:13>
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 visit
https://groups.google.com/d/msgid/django-updates/0107019484eda01e-cdf02d6e-6665-493f-b1dc-b86189977103-000000%40eu-central-1.amazonses.com.