Threading your table drops could be problematic if you are dealing with foreign 
key constraints.  If constraints won't get in the way, just create a threaded 
program to execute multiple statements at a time.  Are you just cleaning out a 
database?  Is speed really a factor here?  Please better describe your problem 
+ environment.

-----Original Message-----
From: E R [mailto:pc88m...@gmail.com] 
Sent: Wednesday, March 02, 2011 1:35 PM
To: Dan Cutler
Cc: dbi-users@perl.org
Subject: Re: Suggest an approach for multi-statements?

On Wed, Mar 2, 2011 at 2:22 PM, Dan Cutler <dcut...@dsm.net> wrote:
> Hi all!
>
> I am seeking some advice.
>
> I need to be able to drop several thousand (more like .25 million) tables 
> from a database using DBI.

I don't think ? place holders work in DROP TABLE statements. AFAIK,
they only work in statements like INSERT, SELECT, UPDATE and DELETE,
and then only to represent data values - not schema related names.
I.e., I've never seen this work: UPDATE FOO SET ? = 1.

Some suggestions:

1. Fork multiple processes to perform the drop table statements (i.e.
use several database connections and processes to perform them in
parallel.)

2. How about just start using a brand-new database schema? Then you'll
start off with zero tables. Copy data from the original schema as
needed. Then you can drop the 250 K tables at your leisure.

Reply via email to