Skip to content
Advertisement

Delete Operation Slows down intermittently oracle 11g

We have a audit Table in production environment where we delete almost 15 millions data everyday(data which is older than some days)in PL/SQL batch. On a good day this query takes 1.5 hours to delete the same data. But intermittently some days this is not deleting the same amount of data even in 4 hours. There is no trigger on this table and Created column is indexed.

Explain pla:

Could you please suggest any possible reason.

Advertisement

Answer

It’s obvious that this is a very busy table. 15M rows/day means about 10416 rows/minute, which means that at the time you are deleting these rows, thousands of records are being inserted. While Oracle tries to delete the old rows, and update the CREATED index, more rows are inserted and committed.

I see you are trying to DELETE 10000 rows at a time. I assume you commit after these 10000 rows, so the following approach may be a bit faster because the SELECT is running only once and you don’t rescan 1500 times the busy table…

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement