IWETHEY v. 0.3.0 | TODO
1,095 registered users | 1 active user | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New Partition the DELETE.
That is, construct DELETE statements 100 or 200 ids at a time. You might also be able to do a DELETE LOW_PRIORITY which makes sure no reads are pending when the delete happens.

The MySQL manual says the size of IN is limited only by the maximum packet size. And that if they're all constants of the same type as the comparing expression, it sorts them and uses a binary search. I think your DBA is talking through his hat.

Wade.

Is it enough to love
Is it enough to breathe
Somebody rip my heart out
And leave me here to bleed
 
Is it enough to die
Somebody save my life
I'd rather be Anything but Ordinary
Please

-- "Anything but Ordinary" by Avril Lavigne.

New MySQL != MS-SQL
But you could use that method to break the deletes up into chunks. Or you could add the selected IDs to a temp table and use that table in your in clause or do an inner join on it. I don't know which would perform best in your situation.

--
Chris Altmann
New D'oh. Missed that. Sorry.

Is it enough to love
Is it enough to breathe
Somebody rip my heart out
And leave me here to bleed
 
Is it enough to die
Somebody save my life
I'd rather be Anything but Ordinary
Please

-- "Anything but Ordinary" by Avril Lavigne.

     Bulk delete - (bluke) - (6)
         Partition the DELETE. - (static) - (2)
             MySQL != MS-SQL - (altmann) - (1)
                 D'oh. Missed that. Sorry. -NT - (static)
         Just throw the list in another table - (ChrisR) - (2)
             But won't I just be spending the time ... - (bluke) - (1)
                 If it's a one time event... - (ChrisR)

Let's ask the Magic Conch Shell!
109 ms