Stage variable Vs Routine- Which one gives good performance

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
dslearner
Premium Member
Premium Member
Posts: 67
Joined: Thu May 26, 2005 3:09 am

Stage variable Vs Routine- Which one gives good performance

Post by dslearner »

Hi all,

i hav a question,if i have a big condition tobe check and using 5 times only in a specific job,can i write routine for that or use stage variable.

In performance issue which is fast stage variable or routine.

can any one help?

Thanks in advance
WoMaWil
Participant
Posts: 482
Joined: Thu Mar 13, 2003 7:17 am
Location: Amsterdam

Post by WoMaWil »

everything depends on your issues. We have to know more about your problem to tell you what will be best.

You can even use a Routine in a Stage Variable.

Routines are usefull if your code is complicated or has to be used several times.

If you are on an optimizing trip you may even consider Transforms.

Wolfgang
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

dslearner,

if you can put your logic in stage variables it tends to be a bit faster than by incurring the overhead of calling a routine (which involves pushing the current program on the stack, calling a new routine, and popping back to the caller). As Wolfgang explained, there are many cases where a routine or a function might serve your purposes better. The difference between using local transform variables and a routine is easily measured; but I would guess that on 1 million calls you would get less than 5 seconds difference in execution time, and if you are doing Database I/O this time might not even come into play.
anupam
Participant
Posts: 172
Joined: Fri Apr 04, 2003 10:51 pm
Location: India

Post by anupam »

First of all, one thing should be noted. i.e. if we call a routine or use stage variable, the same logic would be implemented for both of these methods, that means we would be having the same code at both the places.

So, if the code can be written and is not very complicated then the first choice would be stage variable.

If it is really complicated then we have left with no other then routine as the option.

Performance wise stage variable would provide a better throughput.
----------------
Rgds,
Anupam
----------------
The future is not something we enter. The future is something we create.
amsh76
Charter Member
Charter Member
Posts: 118
Joined: Wed Mar 10, 2004 10:58 pm

Post by amsh76 »

If you are going to use same logic, in different jobs use routine, but if the logic is used specifically for some field in one job you are better off using Stage variable.
Post Reply