oracle delete query taking too much time

前端 未结 7 677
星月不相逢
星月不相逢 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 08:00

    There could be several explanations as to why your query takes a long time:

    1. You could be blocked by another session (most likely). Before you delete you should make sure noone else is locking the rows, eg: issue SELECT NULL FROM tablename WHERE colname=:value FOR UPDATE NOWAIT,
    2. There could be a ON DELETE TRIGGER that does additional work,
    3. Check for UNINDEXED REFERENCE CONSTRAINTS pointing to this table (there is a script from AskTom that will help you determine if such unindexed foreign keys exist).
    0 讨论(0)
提交回复
热议问题