mysql 批量刪除

CREATE PROCEDURE  del_line()spa

BEGIN 索引

      DECLARE count_line INT;ci

        /** 先刪除索引提升刪除速度*/it

ALTER TABLE `test_road_1`.`lebp_logistics_line`  test

DROP INDEX index_carrier_id,mock

DROP INDEX index_state,mock

DROP INDEX index_leave_city,co

DROP INDEX index_leave_city_area,index

DROP INDEX index_arrive_city,gis

DROP INDEX index_arrive_city_area,

DROP INDEX index_mock_attachment;

SELECT COUNT(*) INTO count_line FROM lebp_logistics_line;

WHILE count_line > 0 DO 

   DELETE FROM lebp_logistics_line LIMIT 10000 ;

   COMMIT ;

   SET count_line = count_line - 10000 ;

END WHILE ;

END

相關文章
相關標籤/搜索