tags:

views:

45

answers:

2

Hi,

I am trying to execute the following statement on a table containing 10,000 rows but the query is executing forever.

delete from Table_A where col1 in ('A','B','C') and col2 in ('K','L','M') and col3 in ('H','R',D')

Please can anyone assist!

Thanks A

+1  A: 

It looks as if another session has locked one of the rows you'd like to delete.

Is somebody else working on the same table (with transactions that last more than a few seconds)? Or do you have another tool or session open where you haven't committed your changes?

Update:

Another problem are foreign keys that aren't properly index: If other tables have a foreign key to the table where you want to delete the rows, and if the foreign key column in those tables isn't indexed, then Oracle will try to lock those tables. This could be the cause. If this is the case, index those columns.

Codo
No one else is using the session, and there are'nt any uncommitted transactions. was just wondering if there is any other way of writing this query?
webdevguy
It's almost impossible that a delete statement on a table with 10'000 rows takes more than five seconds. You need to provide more information: How long ist "executing forever"? Are there any triggers on this table? Does the table contain huge BLOB or CLOB values? Do you have a large number of indices?
Codo
+1  A: 

Another possible reason for a database to hang is if the archive log destination is full. Query the V$SESSION_WAIT and V$SESSION_EVENT views to see what your session is waiting for.

Rene