使用WHERE子句优化DELETE FROM

时间:2012-06-29 09:49:47

标签: mysql optimization where sql-delete

如何优化此查询?

DELETE FROM item WHERE id = 1002;
DELETE FROM item WHERE id = 1003;
DELETE FROM item WHERE id = 102232;
DELETE FROM item WHERE id = 12322;

这是一条出路?

DELETE FROM item WHERE id = 1002 OR id = 1003 OR id = 102232 OR id = 12322;

我非常需要专家的心思!

1 个答案:

答案 0 :(得分:2)

DELETE FROM item WHERE id IN (1002,1003,102232,12322)

它更简单,但你的意思是优化(更快?)