How to optimize an update SQL that runs on a Oracle table with 700M rows

后端 未结 5 641
后悔当初
后悔当初 2021-02-06 02:01
UPDATE [TABLE] SET [FIELD]=0 WHERE [FIELD] IS NULL

[TABLE] is an Oracle database table with more than 700 million rows. I cancelled the SQL execution a

5条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-06 02:15

    Some suggestions:

    1. Drop any indexes that contain FIELD before running your UPDATE statement, and then re-add them later.

    2. Write a PL/SQL procedure to do this that commits after every 1000 or 10000 rows.

    Hope this helps.

提交回复
热议问题