I am using a simple perl script to pupulate millions of rows in a mysql DB table. I'm using perl DBI and DBD::mysql with the script. Example code below
my $dbh = DBI->connect(<DB INFO>);
my $sth;
my $insert_com = "INSERT INTO TAB1 VALUES(?,?,?,?,?)";
for (1..50000000){
$sth = $dbh->prepare($insert_com);
$sth->execute(<val1>,<val2>,<val3>,<val4>,<val5>);
}
As per the above code, I think a commit is sent for each iteration of the loop. The question I have is, whether it's possible to send a commit every n iteration ? i.e to commit after inserting n number of rows to the table. If its possible, can someone please tell me how. Thanks in advance. Cheers ...