in reply to How to Speed up MySQL w/ Perl

Probably a paste-o from trimming your real code, but you don't declare or populate %Data anywhere before you loop over its keys. Your stricture would have caught that in running code.

The best opportunity for a speed increase I see is to follow davido's advice and use placeholders. Your UPDATE can be defined once, outside the loop, by saying

my $usth->'update new_table set newData=? where newID=?'; foreach (keys (%Data)) { $usth->execute( $Data{$_}, $_ ); );
You may get some speed by changing that loop to while ( my ($id, $data) = each %Data) { $usth->execute( $data, $id);}. That could be if %Data is large.

You should check for errors each time you go to the database server. You can ease the pain of that by setting RaiseError=>1 in the connect call.

The biggest source of slowness in DBI is usually just grabbing too much data at once. Refining your demands will help that most.

After Compline,
Zaxo