Search code examples
mysqlinsertlimit

What is the record limit of MySQL extended insert statement?


What is the record limit (n) of MySQL extended insert statement?

INSERT INTO table (field) VALUES (1),(2),(n)

What happens when the limit exceeds? Will only overflow rows left out or the whole statement failed?


Solution

  • I don't believe there's any hard limit on the number of rows inserted. There is a limit on the maximum size of a MySQL query in general, though; statements longer than the setting of max_allowed_packet will be rejected by the server. (They won't run at all.)

    MySQL 5.5.6 changed the default value of max_allowed_packet from 1 MB to 4 MB. That's still quite a bit. :)