我说的是 $sql="insert into tables value(xxx1,xxxx,xxx,.....);insert into tables value(xxx2,xxxx,xxx,.....);insert into tables value(xxx3,xxxx,xxx,.....);......";和$sql="insert into tables select (xxx1,xxxx,xxx,.....)union all select (xxx2,xxxx,xxx,.....)union all select (xxx3,xxxx,xxx,.....)union all.....";数据导入表中谁快点?(百万数据)
$sql="insert into tables value(xxx1,xxxx,xxx,.....);insert into tables value(xxx2,xxxx,xxx,.....);insert into tables value(xxx3,xxxx,xxx,.....);......";和$sql="insert into tables select (xxx1,xxxx,xxx,.....)union all select (xxx2,xxxx,xxx,.....)union all select (xxx3,xxxx,xxx,.....)union all.....";数据导入表中谁快点?(百万数据)
一条一条来。 写好存储过程。事务回滚
[/Quote
现在用mysql基本都是MyISAM,Innodb貌似不多见,这样事我觉得不需要考虑事务性。
但是百w级的数据你这样做的话效率反倒低了,没insert into select 来的方便快捷!
load data local infile ……