speeding a lot rebuild_nozebra by using autocommit OFF feature
authorPaul POULAIN <paul.poulain@biblibre.com>
Tue, 19 Feb 2008 17:55:13 +0000 (06:55 +1300)
committerJoshua Ferraro <jmf@liblime.com>
Wed, 20 Feb 2008 02:27:24 +0000 (20:27 -0600)
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
misc/migration_tools/rebuild_nozebra.pl

index 888c7ae..a1191af 100755 (executable)
@@ -165,6 +165,10 @@ while (my ($biblionumber) = $sth->fetchrow) {
 }
 print "\nInserting records...\n";
 $i=0;
+
+my $commitnum = 100;
+$dbh->{AutoCommit} = 0;
+
 $sth = $dbh->prepare("INSERT INTO nozebra (server,indexname,value,biblionumbers) VALUES ('biblioserver',?,?,?)");
 foreach my $key (keys %result) {
     foreach my $index (keys %{$result{$key}}) {
@@ -174,6 +178,7 @@ foreach my $key (keys %result) {
         print "\r$i";
         $i++;
         $sth->execute($key,$index,$result{$key}->{$index});
+        $dbh->commit() if (0 == $i % $commitnum);
     }
 }
 print "\nbiblios done\n";