Mohit Jain
Mohit Jain

Reputation: 3

Delete query takes too long time to execute

I am running a simple delete query:

delete from table where column_name in (value1, value2, ...)

But its taking too long time to execute, although it completes - but not quickly. The table is not indexed. I have killed all the running sessions also. A few days back it was running very smoothly, I don't know why, it's behaving weird.

Please throw your valuable thoughts over here.

Upvotes: 0

Views: 3287

Answers (1)

Boneist
Boneist

Reputation: 23588

Whilst indexing the column you're filtering against may help (it may not; it depends on the percentage of rows in the table that are affected, the size of the table, how the data is organised within the table etc.), if the delete was previously running in an acceptable time before but it's not any more (using the exact same filter condition), then something must have changed.

My guess is that you have a lot more data in the table than before, but there could be a variety of factors, such as memory, a deleted index, etc etc. It would help if you had the execution plan from when the delete was running ok along with the current execution plan. That might throw up some issues.

Upvotes: 1

Related Questions