select subquery cause mysql server to be unresponsive
- by Xiao
DELETE FROM item_measurement
WHERE measurement_id IN (
SELECT (-id) AS measurement_id
FROM invoice_item
WHERE invoice_id = 'A3722'
)
I've really tried hard to find what's wrong with the code. I tried to run this in a php page, which doesn't respond. I also tried the same line in phpmyadmin, infinite spinning circle and I had to restart the server(MAMP on Mac 10.9). No error was given in browser/
If I run the delete and select separately, they both finish very quickly. I don't think it's a performance issue because the separate run took < 0.1 sec each.
Thanks for any help in advance.
Edit:
I also found that a simple select statement will also suspend mysql:
select *
from item_measurement
where measurement_id in
(select -id from invoice_item where invoice_id='A3722')