Forum Moderators: open

Message Too Old, No Replies

Hung server on massive DELETE

Can I kill the mysql process?

         

whoisgregg

6:47 pm on Aug 10, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi!

I ran a query that seems to have hung my server. :(

DELETE FROM `cart_cart` 
WHERE KeyCart NOT IN ( SELECT DISTINCT `KeyCart` FROM `cart_lines` )
AND `TSCreation`<= DATE_SUB(CURDATE(),INTERVAL 60 DAY)

`cart_cart` had just over 1 million records and `cart_lines` had 1,930 (with 900 distinct KeyCarts).

The site that checks this db is hung. Can I terminate the mysql process or will that corrupt the open databases?

And, before I look like too much of a tool, the SELECT of this command only took 0.0015 seconds to run. I knew the DELETE would take longer but it's been over 5 minutes and I was *not* expecting that.

bsterz

2:44 am on Aug 14, 2007 (gmt 0)

10+ Year Member



It's been my experience that even if it corrupts you can repair the tables. Your mileage may vary

whoisgregg

3:26 pm on Aug 14, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Good to know, bsterz. As it turned out, I just waited. It took about 15-20 minutes overall. Now I have a cron that cleans out abandoned carts every night so I shouldn't have to deal with that issue again.