Surrogate Key issue

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
prem84
Premium Member
Premium Member
Posts: 25
Joined: Sat Jul 03, 2010 11:55 pm
Location: chennai

Surrogate Key issue

Post by prem84 »

Hi
I used a surrogate key generator stage. My job consists of

Flat file -- > Surrogate stage --> Flat file

Input file consists of name and I have to assign a sequence number to it.
Input file
------------
xxxx
yyyyy
zzzzz
ccccc

I created a state file using UNIX touch command and in the surrogate key generator stage
I used file initial value to 1 and file block size as user specified set to 1.When I run it first time
I get the following data out
1 xxxx
2 yyyyy
3 zzzzz
4 ccccc
And the state file is also updated. I have restricted node map constraint to one node. But when I run the second time I have sequence value starting from 6 and not 5

6 xxxx1
7 yyyyy1
8 zzzzz1
9 ccccc1

And same problem for subsequent runs

11 xxxx2
12 yyyyy2
13 zzzzz2
14 ccccc2

Last value is getting skipped.
Kindly advice on this issue
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Keys are allocated in blocks. If not all keys in a block are used (due to slight variations in the number of rows per partition) they are discarded.

That DOES NOT MATTER. Surrogate keys provide only uniqueness. They are not - and should not be - guaranteed to be contiguous.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
mhester
Participant
Posts: 622
Joined: Tue Mar 04, 2003 5:26 am
Location: Phoenix, AZ
Contact:

Post by mhester »

And if your desire is to have a contiguous value then the SK generator is not what you want to use anyways.
Post Reply