note
samtregar
What database are you using? If it's MySQL I'm pretty sure a multi-value insert will be faster. For example, you could insert in blocks of 100:
<p>
<code>
my $sql = "INSERT INTO temp_selectedTitles values ". join(", ", "(?)" x 100);
my $sth = $dbh->prepare($sql);
for (my $i = 0; $i <= $#books; $i+=100) {
$sth->execute(@books[$i..$i+99]);
}
</code>
<p>
Of course if you don't have an exact number of blocks then you have to clean up what's left with another statement, either one at a time or custom fitted. I use this technique all the time and it always beats going row by row.
<p>
I think execute_array() is mostly abandoned at this point - I can't remember the last time I saw it used outside the DBI docs.
<p>
-sam
743082
743082