Page 1 of 1

surrogate key generator generating improper sequence

Posted: Mon May 09, 2011 11:08 pm
by srinivas.nettalam
I have a job that runs on 2 nodes.I created the statefile through the surrogate key generator stage create option.
I tried to generate the sequence numbers for 107 source records.

The numbers were generated as
1 - 53 on node1
1001-1054 on node2

I was expecting that the sequence numbers would be from 1- 107.
Did I miss someoption somewhere?

Re: surrogate key generator generating improper sequence

Posted: Mon May 09, 2011 11:18 pm
by SURA
If i am right, look into system variables. it will help you.

Posted: Tue May 10, 2011 12:13 am
by ray.wurlod
This is perfectly expected behaviour where block size is set to 1000.

Posted: Tue May 10, 2011 3:51 am
by srinivas.nettalam
What do I do to get the sequence numbers normally?Do I need to change the block size?

Posted: Tue May 10, 2011 4:33 am
by ray.wurlod
Yes.

Posted: Tue May 10, 2011 4:36 am
by ray.wurlod
But it doesn't matter.

A surrogate key provides uniqueness, just uniqueness, and nothing but uniqueness. There's neither guarantee nor requirement that the numbers will form any kind of sequence.

Posted: Tue May 10, 2011 4:56 am
by vmcburney
The Surrogate Key stage and the Slowly Changing Dimension stage keep the values of the latest surrogate key stored in a state file - a text file on the server. It's a good idea to set a high block value in order for performance. If you set a block value of 1 it retrieves and writes back a value in this file with every row of data - and this makes the job terribly slow. With a block value of 1,000 each node retrieves the latest value and adds 1,000 to it and writes it back and you only need to update the file every 1,000 rows rather than with every row. You lose surrogate key values but then surrogate keys are not supposed to be intelligent or a count field. If you have a dimension table with a small number of rows you can set a much smaller block size to avoid going through the numbers as quickly.

Posted: Tue May 10, 2011 11:31 pm
by srinivas.nettalam
I changed the File block size to 1 and attained the desired output.
Thank You All