DELETE FROM minute1_pp01temp WHERE id> 111352;... ... [SQL] DELETE FROM minute1_pp01temp WHERE id> 111352;受影响的行: 448 时间: 0.016s [SQL] DELETE FROM minute1_pp01temp WHERE id> 111352;受影响的行: 448 时间: 0.016s
面对疾风吧2016-11-08 15:23:50
1、mysql删除大量数据,直接delete会锁表,用存储过程循环执行delete比较方便。
例如:
DELIMITER $$CREATE PROCEDURE delete_temp_tab()BEGIN REPEAT DELETE FROM test.`tab` WHERE id > 111352 LIMIT 1000; UNTIL ROW_COUNT()=0 END REPEAT;END $$ DELIMITER ;CALL delete_temp_tab();DROP PROCEDURE IF EXISTS delete_temp_tab;
2、要么就是把需要的数据导入到一张新的表中,再把原表删除。