-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160

> I need to be able to drop several thousand (more like .25 million) 
> tables from a database using DBI.
...
> The SLOW typical version:
>   while (my @rows = $sth->fetchrow_array) {  # Get the list of tables to drop 
> from the a simple SQL query.
>       my ($tablename) = @rows;
>       $dbh->do("drop table $db.$tablename") or die $sql->errstr;
>    }

Dropping a table is a relatively expensive thing to do, so this 
may be as good as it gets. It's possible the driver's do() 
method is not optimized; you should test it against deletion using 
the database's built-in command line utility. It's also possible 
there are some optimizations you can do at the database level 
(e.g. in Postgres you could disable fsync), but that's outside 
the scope of this list.

- -- 
Greg Sabino Mullane g...@turnstep.com
End Point Corporation http://www.endpoint.com/
PGP Key: 0x14964AC8 201103021530
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
-----BEGIN PGP SIGNATURE-----

iEYEAREDAAYFAk1uqSAACgkQvJuQZxSWSsiCTQCggkBNtJhAi7tPKMsPLbd66qsN
giYAoO6CC+WGx9Vqq6FgQSDsMGXhD09A
=ll48
-----END PGP SIGNATURE-----


Reply via email to