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)?
views:
32answers:
2
                +1 
                A: 
                
                
              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
                  Haim Evgi
                   2009-12-28 14:44:20
                
              So, no restriction on the number of records in one bulk insert?
                  Itay Moav
                   2009-12-28 14:48:28
                yes -----  :) :)
                  Haim Evgi
                   2009-12-28 14:49:19
                Thank you :-) 123345656
                  Itay Moav
                   2009-12-28 14:51:17
                be aware if run it in one query , if u have a little problem in one statement , all the query fail
                  Haim Evgi
                   2009-12-28 14:59:12
                Are you sure? I think all the inserts until the failure are being performed.
                  Itay Moav
                   2009-12-28 17:11:37
                i mean if you have Error  in one statement like Column count doesn't match ...
                  Haim Evgi
                   2009-12-29 06:20:57
                
                
                A: 
                
                
              
            The more the merrier. It's much faster to do one massive insert, rather than various simple ones. You eliminate a lot of overhead doing massive inserts, rather than many small ones.
                  mhughes
                   2009-12-28 18:06:19