[https://dev.mysql.com/doc/refman/8.0/en/innodb-auto-increment-
handling.html The criteria are the following]
> Use simple-inserts (e.g. no subquery or insert from select) and don't
mix objects with primary keys and ones without.
`bulk_create` doesn't rely on subqueries and
[https://github.com/django/django/blob/6220c445c40a6a7f4d442de8bde2628346153963/django/db/models/query.py#L796-L822
it already partitions between objects with and without a primary key].
> Don't use `innodb_autoinc_lock_mode=2` (interleaved) with
`binlog_format=STATEMENT`
This is detectable by issuing introspection just like we do with other
`connection.features`.
The default on MySQL 5.7 was `(innodb_autoinc_lock_mode=1,
binlog_format=STATEMENT)` and is `(innodb_autoinc_lock_mode=2,
binlog_format=ROW)` on MySQL 8 which both ensures that ''auto-increment
values are assigned in a predictable and repeatable order''
[https://dev.mysql.com/doc/refman/8.0/en/innodb-
parameters.html#sysvar_innodb_autoinc_lock_mode as explained in the docs]
and thus allows for this feature to be used in setups using default InnoDB
configurations.
--
Ticket URL: <https://code.djangoproject.com/ticket/34011>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => closed
* resolution: => duplicate
Comment:
Thanks, it's worth trying. I think we can close it as a duplicate of
#19527.
--
Ticket URL: <https://code.djangoproject.com/ticket/34011#comment:1>