> here, @ids is the array, delete in chunks of 64:
> while ( my(@id)= splice(@ids,0,64)) {
>   $qry="DELETE FROM master WHERE master_id in (".join(',',@id).")";
>   SQLQuery($qry);
> }

I thought about this, too..  But Mark said that he needed to delete from the
table where the ID's don't match.  If you break it into chunks, then you'd
end up deleting everything that doesn't match that first chunk, which kills
pretty much the entire table.

The other option would be to create a new field in the table, something like
"dontdeleteme TinyInt Unsigned Not Null Default 0"...  Then use your splice
technique to do something like:

    $dbh->do('UPDATE master SET dontdeleteme=0');
    while ( my(@id)= splice(@ids,0,64)) {
        $dbh->do("UPDATE master SET dontdeleteme=1 WHERE master_id in
            (".join(',',@id).")");
    }
    $dbh->do('DELETE FROM master WHERE dontdeleteme=<1');


I have no idea if this is slower or not, but I do use a similar technique on
a client's database.  Granted, that one is about 6800 records, not 68000.
But it's still another thought.

-Chris


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to