我想在一次插入更多的行到我的SQL表中。我想知道什么是最好的办法。批处理SQL是否插入mySQL优化的好方法?
1)使用INSERT语句对于每条数据
INSERT INTO message (email, txt) VALUES ('[email protected]', 'txt1');
INSERT INTO message (email, txt) VALUES ('[email protected]', 'txt2');
INSERT INTO message (email, txt) VALUES ('[email protected]', 'txt3');
2),或者使用批量插入,而不是它?
INSERT INTO message (email, txt) VALUES ('[email protected]', 'txt1'),('[email protected]', 'txt2'),('[email protected]', 'txt3');
我们正在讨论每插入数十条数据。从优化的角度来看哪一个更好?
BTW:TXT文本是类型列
谢谢你的忠告提前!
Jakub
OP说MySQL,你的链接是用于Oracle的;它们可能没有意义。 – MarkR
@markr的权利,删除链接...试图找到一些MySQL的基准... – hvgotcodes