Bug #64664 | Batched inserts are as slow as individual inserts | ||
---|---|---|---|
Submitted: | 15 Mar 2012 21:16 | Modified: | 16 Mar 2012 16:14 |
Reporter: | Stefan Müller | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | Connector / J | Severity: | S5 (Performance) |
Version: | mysql connector java 5.1.18 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[15 Mar 2012 21:16]
Stefan Müller
[15 Mar 2012 21:16]
Stefan Müller
Creates and fills a table using different batching methods
Attachment: FillTable.java (application/octet-stream, text), 3.12 KiB.
[16 Mar 2012 16:14]
Mark Matthews
Mysql itself doesn't have a "batch" mode for prepared statements. For certain cases, the driver can rewrite batches into much more efficient multi-value inserts, see http://www.jroller.com/mmatthews/entry/speeding_up_batch_inserts_for (this feature is not enabled by default). The other option is to use LOAD DATA [LOCAL] INFILE, which is even much more efficient (no SQL parsing is done).