Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the optimal batch size in django

Tags:

python

django

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?

like image 309
Gunobaba Avatar asked Oct 20 '25 09:10

Gunobaba


1 Answers

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.

like image 150
Yılmaz Baysal Avatar answered Oct 21 '25 21:10

Yılmaz Baysal



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!