Delete statement was very slow in Oracle

前端 未结 4 2362
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-20 17:15

I have a table with about 100k records and I want to delete some rows, The problem is that the DELETE statement is running very slowly - it didn\'t finish in 30 min

4条回答
  •  感动是毒
    2021-02-20 18:05

    When DML operations take a long time, create new table with the remaining rows and drop the previous table, instead of deleting.

    I mean,

    create table NEW_TABLE as
    select * from daily_au_by_service_summary  
    where summary_ts <= to_date('09-04-2012','dd-mm-yyyy'); 
    

    This will be faster, especially when you are deleting a substantial number of rows. (%10 of total rows, for example.)

提交回复
热议问题