I'm wondering that the optimal batch size while making bulk create in Django. I don't know the exact number of data. It might be millions or thousands. How can I decide the optimal batch size?
It is more dependent on the database setup than Django. Because in the implementation of bulk_update
, a given list of objects is divided into batches, and then insert statements are created for each batch. The insert statements are then executed on the database. As a result, the batch's execution is handled by the database. If the batch_size
is too large for your database configuration, you may experience performance issues and even errors.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With