speeding a lot rebuild_nozebra by using autocommit OFF feature

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
This commit is contained in:
Paul POULAIN 2008-02-20 06:55:13 +13:00 committed by Joshua Ferraro
parent b0d18cfd4d
commit bcf36122a6
1 changed files with 5 additions and 0 deletions

View File

@ -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";