oracle delete query taking too much time

前端 未结 7 720
星月不相逢
星月不相逢 2020-12-05 07:34

I have a query like

DELETE from tablename where colname = value;

which takes awfully long time to execute. What could be the reason? I have

7条回答
  •  庸人自扰
    2020-12-05 07:43

    There is a significant difference between Oracle and mysql :

    Oracle does not create index automatically for foreign keys but mysql does. Then if you have some parent table that you may execute delete command on it then you must create index on foreign keys in child tables otherwise the delete command on parent table will be very very slow if child tables has a lot of rows, because it must surf all records of child table per deletion of any parent records.

    Then be careful when you want to delete from parent table in Oracle database.

提交回复
热议问题