in reply to Bulk data insertion into MySql
I took the above "SET autocommit = 0" from some MySQL code that worked in my app. If you commit every 1/4-1/2 million records or so, the performance will be fine. There can be other ways to start the transaction, perhaps BEGIN or other keywords.$dbh->do("SET autocommit = 0"); .... $dbh->do("COMMIT");
I do find this map pretty ugly:
map { my($keys,$value)=split /\s*:\s*/,$_; $keys=~ s/\s//g; $info{$keys} = $value; }split /\n/, $record; #Don't use map when you mean foreach (or for) foreach (split /\n/, $record) { .... }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Bulk data insertion into MySql
by sowraaj (Novice) on Sep 03, 2011 at 12:31 UTC | |
by Anonymous Monk on Sep 03, 2011 at 19:45 UTC |