可能重複:
Which is faster: multiple single INSERTs or one multiple-row INSERT?高效的多行插入
雖然經歷了一本關於MySQL的,我發現了兩種方式在數據庫中插入一行。
Method 1
INSERT INTO tableName (col1, col2, col3) VALUES('a', 'b', 'c');
INSERT INTO tableName (col1, col2, col3) VALUES('d', 'b', 'c');
INSERT INTO tableName (col1, col2, col3) VALUES('e', 'b', 'c');
Method 2
INSERT INTO tableName (col1, col2, col3) VALUES('a', 'b', 'c'), ('d', 'b', 'c'), ('e', 'b', 'c');
第二種方法比第一種方法更有效嗎?或者它只是多次撥打Method 1
?
[閱讀本文](http://stackoverflow.com/questions/1793169/which-is-faster-multiple-single-inserts-or-one-multiple-row-insert) –
太棒了,謝謝! –