Delete on oracle taking long

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
samsuf2002
Premium Member
Premium Member
Posts: 397
Joined: Wed Apr 12, 2006 2:28 pm
Location: Tennesse

Delete on oracle taking long

Post by samsuf2002 »

I am running a job with two Oracle stages where it extracts the Key of table A and in second stage deletes some record from table A based on some conditions.

In the target I am using user define query for delete rows. like

DELETE FROM TABLE A
where KEY in (........

The job starts fine and it even delete those records which I can see on Database side but even after deleting the jobs doesn't finish, it shows running status for hours.

I am not sure what's going on DB side. Are there any other way to achieve this ?

Any help will be appreciated.
hi sam here
mekrreddy
Participant
Posts: 88
Joined: Wed Oct 08, 2008 11:12 am

Post by mekrreddy »

Let me know if the Oracle database is on same server, if not whats the database version and the client connector version.
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Check for locks in oracle. Try running on single node config.
samsuf2002
Premium Member
Premium Member
Posts: 397
Joined: Wed Apr 12, 2006 2:28 pm
Location: Tennesse

Post by samsuf2002 »

Datastage and oracle are on same server.

I am not sure but i tried using nolock in my query but it dint work.
hi sam here
mekrreddy
Participant
Posts: 88
Joined: Wed Oct 08, 2008 11:12 am

Post by mekrreddy »

Try running job by constructing new Oracle stage without any parameters.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Sainath.Srinivasan wrote:Try running on single node config.
Did you do that?
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
samsuf2002
Premium Member
Premium Member
Posts: 397
Joined: Wed Apr 12, 2006 2:28 pm
Location: Tennesse

Post by samsuf2002 »

Yes I tried running with single node but still the same issue.
hi sam here
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Get your DBA to monitor the session. In my experience DELETE does take a very long time, particularly when there are referential integrity constraints involved.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

But the fact that the deletes 'can be seen' on the database side, which I take to mean they can be seen to be gone, would imply they have been committed and thus the Oracle part is done. Well... unless intermediate commits are being done and they only checked some. :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

How did you find it is the 'delete' stage that takes time?

How many rows matching the delete criteria are available in the target?

What if you do a delete outside DS? How long does it take?

Did you set commit intervals and see the count go down?

Did you get the plan for delete SQL?
priyadarshikunal
Premium Member
Premium Member
Posts: 1735
Joined: Thu Mar 01, 2007 5:44 am
Location: Troy, MI

Post by priyadarshikunal »

In addition to that

If you are sure database is taking time then
Check the indexes on columns used in where condition. I believe Its indexed as you termed it as KEY.

Analyze the table and indexes. If references of that table are present in the database analyse all referneced tables and indexes.

Check if cascade delete is enabled on that table generally it should not.

Ask your DBA to monitor the session to find any bottlenecks.
Priyadarshi Kunal

Genius may have its limitations, but stupidity is not thus handicapped. :wink:
choudary_sivaji
Participant
Posts: 3
Joined: Tue Feb 07, 2006 6:56 am

Post by choudary_sivaji »

Hi,
Are you selecting and deleting from same table?
if that is the case then it will lock.

regards
sivaji
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Selecting and deleting from same table will not cause locks unless you lock with 'FOR UPDATE'.

It may result in blowing your temp, rollback or redo spaces (depending on version and action in Oracle).
Post Reply