#36143: DatabaseOperations.bulk_batch_size() is overly protective on SQLite in most cases -------------------------------------+------------------------------------- Reporter: Sarah Boyce | Owner: Xavier Type: | Frankline Odhiambo Cleanup/optimization | Status: assigned Component: Database layer | Version: 5.1 (models, ORM) | Severity: Normal | Resolution: Keywords: | Triage Stage: Accepted Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+------------------------------------- Comment (by Sage Abdullah):
[https://github.com/django/django/pull/19427 PR] Xavier and I worked on this during the Djangonaut Space program, and I added tests during the DjangoCon Europe 2025 sprints. I also made a [https://github.com/laymonage/django-sqlite-bulk- optimization/blob/main/app/tests.py#L16-L18 repo] to experiment with the impact and I can confirm that this reduces the number of queries in bulk operations quite significantly. Interestingly, using the `CaptureQueriesContext` (either directly or via `self.assertNumQueries`) made the test crawl after increasing the query parameter limit, so maybe there's room for optimization in there. Without capturing the queries, the operation is fast even with a large number of parameters. -- Ticket URL: <https://code.djangoproject.com/ticket/36143#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 django-updates+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/django-updates/01070196777b7ed4-14269045-5f02-46cb-86ee-0cd02b66fdff-000000%40eu-central-1.amazonses.com.