Same Table as Source and Target

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
ReachKumar
Participant
Posts: 29
Joined: Wed Jan 06, 2010 7:18 am

Same Table as Source and Target

Post by ReachKumar »

Hi,

Can we use same table as source and target.

Job : Db2stage and lookup file -> Transformer -> DB2stage

Thanks in advance.
Regards,
Kumar
srinivas.g
Participant
Posts: 251
Joined: Mon Jun 09, 2008 5:52 am

Post by srinivas.g »

Yes ........you can use same table as a source and target.
Srinu Gadipudi
grimm336
Participant
Posts: 12
Joined: Thu Jun 25, 2009 10:19 am

Post by grimm336 »

Yes you can do that.....But you should use intermediate files or tables for streaming stages
grimm
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Such blocking operations are not permitted in parallel jobs. Grimm's solution would require two jobs.

You can use the same table as source and target but you need to make sure that self-deadlocking does not occur, typically by using a transaction size of 1 and an array size of 1 and partitioning on the table key (so that the same key can not arrive into the table from more than one node, which might also cause a locking issue).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ReachKumar
Participant
Posts: 29
Joined: Wed Jan 06, 2010 7:18 am

Post by ReachKumar »

So its better to avoid to have the same table as source and target.

If my requirement is truncate and load, then i think its not possible to use same table as source and target.

Am i correct?
Regards,
Kumar
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

If you stopped and thought about it for a moment, you'd realize the answer is that "it is not possible" in that scenario.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ShaneMuir
Premium Member
Premium Member
Posts: 508
Joined: Tue Jun 15, 2004 5:00 am
Location: London

Post by ShaneMuir »

What if the source DB2 stage was infact the lookup? Depending on the job requirements, if you were to read the source data into memory first and used the sequential stage as the primary link. Or does it not actually load the lookup data into memory first?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Good thinking, and it may work but it may not. Certainly with a normal reference link the reference data set is completely loaded into memory and an index built before the first lookup is attempted, which is the situation where it may work, provided the database does not continue to hold any lock until the connection is closed.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ReachKumar
Participant
Posts: 29
Joined: Wed Jan 06, 2010 7:18 am

Post by ReachKumar »

Informative.. Thanks
Regards,
Kumar
Post Reply