in reply to Deleting all from all tables in MYSQL
I would try doing this:
my $sqlString = 'delete from %s;'; $dbh->begin_work; my @tables = ('table1','table2','table3'); foreach my $table (@tables) { my $sth = sprintf($sqlString, $table); $dbh->do( $dth ); } $dbh->commit;
This would speed it up some, but double-check the DBI doco on cpan for the 'begin_work' function before you do it on how it will react since I think it depends on the database you use and whether it supports transactions or not.
The last thing you could try could be a drop/create where you basically drop the old table and re-create it from scratch... That will definately speed it up, but some people get twitchy when doing it :)
Something like
$dth->do("drop table0"); $dth->do("create table0 ( col1 def, col2 def.....)"); etc....
|
|---|