Page 1 of 1

Break in the sequence numbers

Posted: Wed Mar 23, 2011 11:40 am
by prasad v
Hi

I am generating the sequence numbers by using below code:
@PARTITIONNUM + (@NUMPARTITIONS * (@INROWNUM - 1)) + 1
It is not giving the exacttly

Eg:

3
4
5
6
7
8
9
10
12
13


Here 11 is missing, i am using Round robin partition method. Can any body suggest me what needs to be used in this case?

Thanks in advancee[/quote]

Posted: Wed Mar 23, 2011 12:30 pm
by vinothkumar
Try this code

( (@INROWNUM - 1) * @NUMPARTITIONS + @PARTITIONNUM + 1)

Posted: Wed Mar 23, 2011 1:56 pm
by prasad v
I could not find any difference in both of these codes.

Posted: Wed Mar 23, 2011 2:01 pm
by ray.wurlod
Does your Transformer stage include any constraint expressions? Use Monitor to verify that all nodes processed the same number of rows.

Posted: Wed Mar 23, 2011 2:13 pm
by prasad v
There is no Constraints expressions in Transformer.

As i mentioned, i used Round Robin method. i think it makes the same no.of records as per the incoming count.

Posted: Wed Mar 23, 2011 4:57 pm
by jwiles
About the only way to guarantee you have no gaps in a sequence number assignment using a formulaic method like this is to run the stage in sequential mode. Even though Round Robin partitioning gives you as-close-to-possible even distribution among the partitions, that's only possible when the number of records is evenly divisible by the number of partitions and how often does that occur naturally in parallel data processing?

Surrogate Key Generator stage using a static file with a block size of 1 would work in a parallel environment, but that blocksize will create a major bottleneck to processing (I've seen it done). I would prefer running a sequential stage rather than SKG with a blocksize of 1. A database sequence MIGHT give better performance but I haven't tried it.

The question to ask is: Must you absolutely have no gaps in the assigned sequence number? If so, and you're reading from a sequential file (and not in parallel), you could assign record numbers in the sequential file stage.

Regards,

Re: Break in the sequence numbers

Posted: Thu Mar 24, 2011 12:50 am
by suresh.angadi
Hi Prasad,

@PARTITIONNUM + (@NUMPARTITIONS * (@INROWNUM - 1)) + 1
((@INROWNUM - 1) * @NUMPARTITIONS + @PARTITIONNUM + 1)

both the formula for getting seq no works fine, i think some logic problem in your job.

can you explain what is your datastage job logic.

Regards
Suresh