#18669: QuerySet.bulk_create should batch if no AutoField -------------------------------------+------------------------------------- Reporter: jdunck | Owner: jdunck Type: | Status: new Uncategorized | Version: 1.4 Component: Database | Keywords: layer (models, ORM) | Has patch: 0 Severity: Normal | Needs tests: 0 Triage Stage: | Easy pickings: 0 Unreviewed | Needs documentation: 0 | Patch needs improvement: 0 | UI/UX: 0 | -------------------------------------+------------------------------------- .bulk_create branches on can_combine_inserts_with_and_without_auto_increment_pk *and* _meta.has_auto_field, but it should be can_combine_inserts_with_and_without_auto_increment_pk or not _meta.has_auto_field.
https://github.com/django/django/blob/f3c9a16a423c90baaf3804cb050d320741f799a2/django/db/models/query.py#L421 This buglet means that even if the model doesn't have an autofield, the list will be partitioned into models with and without the PK, resulting in unnecessary query executions. I'm assigning myself as owner because I intend to patch it. -- Ticket URL: <https://code.djangoproject.com/ticket/18669> 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 post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.