How to avoid update query

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
kaushal
Participant
Posts: 13
Joined: Mon Sep 01, 2008 4:53 am
Location: Bangalore

How to avoid update query

Post by kaushal »

I have to update aprox 20000 records.Since i am using same the same table as input and ouput,so i need time delay .to update the records of volume aprox 20000,its take too much time,is it any alternate to avoid writing update query at output.
Regards
Kaushal Kumar
DS_SUPPORT
Premium Member
Premium Member
Posts: 232
Joined: Fri Aug 04, 2006 1:20 am
Location: Bangalore

Post by DS_SUPPORT »

Introduce a Sequential file in your process, it will actually stop the process until all the rows are read. So your update process will start only after you read your entire input.

There might be some other method also, wait for MASTERS replies.
kaushal
Participant
Posts: 13
Joined: Mon Sep 01, 2008 4:53 am
Location: Bangalore

Post by kaushal »

Ya i have taken sequential file between process,So i am able to update a records,but the problem is its taking too much time to update 20 thousands records.So i need to know is any alternate method imstead of update query in job.
Regards
Kaushal Kumar
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

No. UPDATE is, by its very nature, slow. Think about all the things UPDATE has to do.
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 »

How long is "too much time"? How many indexes on your target table and is there one over the key column(s) you are using for the update? What about foreign keys? Check constraints? Triggers? As noted, there are many factors that effect update speed.

Can you avoid an update? You tell us. One method would be to use the 'Replace completely' Update Action (if that's available for your database, you haven't mentioned) which does a delete and then an insert but I doubt it will be faster.
-craig

"You can never have too many knives" -- Logan Nine Fingers
kaushal
Participant
Posts: 13
Joined: Mon Sep 01, 2008 4:53 am
Location: Bangalore

Post by kaushal »

Ya ,in table i have index,key column,no foreign key.If I use replacement before updation(may be insert into table),I have concurn in that??...If suppose insertion get faild due to some cause,it will become a big problem bcz the existing records get deleted before data,which become a business problem???
Regards
Kaushal Kumar
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

That would entirely depend on how you handled these errors. Me, I would use a transaction size of 0, then abort the job and rollback all the work if there were any problems. That and design the job such that errors would be a remote possibility. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
kaushal
Participant
Posts: 13
Joined: Mon Sep 01, 2008 4:53 am
Location: Bangalore

Post by kaushal »

I am using transaction size as 100.The update query is working,Problem is its like 100 record updation/min which is too slow when i need to update 20 thousand record,this speed is not acceptable...... :cry:
Regards
Kaushal Kumar
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

What database? What stage? What array size? :?

Work with your DBA, see what suggestions they have to improve the speed.
-craig

"You can never have too many knives" -- Logan Nine Fingers
major
Premium Member
Premium Member
Posts: 167
Joined: Mon Nov 26, 2007 12:21 am

Post by major »

kaushal wrote:I am using transaction size as 100.The update query is working,Problem is its like 100 record updation/min which is too slow when i need to update 20 thousand record,this speed is not acceptable...... :cry:
Try user defined query instead of generated query or else you can write a store proc for update action
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

How would that help? An update is an update. :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply