Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there an optimal number of records OR data size I can insert in one request?

Using the Mysql multi insert statement (Inserting several records in one INSERT statement). Is there an optimal number for the number of records I can insert in one go, Or to the data size (bytes)?

like image 603
Itay Moav -Malimovka Avatar asked Dec 04 '25 15:12

Itay Moav -Malimovka


1 Answers

the limit is to the size of the row , one row query is limited ,

The server's default max_allowed_packet value is 1MB. You can increase this if the server needs to handle big queries (for example, if you are working with big BLOB columns).

u can defined it in the mysql.cnf file

the parameter is

[mysqld]
max_allowed_packet=16M

or set like

shell> mysql --max_allowed_packet=32M

link :

http://dev.mysql.com/doc/refman/5.1/en/packet-too-large.html

like image 85
Haim Evgi Avatar answered Dec 07 '25 04:12

Haim Evgi



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!