Page 1 of 1

Getting irregular values after using Surrogate Key Generator

Posted: Fri Mar 14, 2008 8:18 am
by sateeshbabu
Hi,
Our team is designing a job in which we are using surrogate key generator [In parallel mode] .It is being used to generate value for the key column "User_ID".

Problem ::

After using this stage , the User_ID does not appear in sequence.


We want it to be in a sequence.

PLEASE SUGGEST SOME SOLUTION SO THAT THE USER_ID COULD BE OBTAINED IN A SEQUENCE USING PARALLEL MODE.

** The mode of execution can be made sequential,but it will slow down the performance.Performance is a big issue FOR US because we have to deal with a large number of records.

Posted: Fri Mar 14, 2008 4:52 pm
by ray.wurlod
You can never get them in sequence in parallel mode. Think about it. With two nodes, one side is generating the odd numbers, the other node is generating the even numbers. Assuming both nodes are operating at the same speed, the output would be in sequence: 0,1,2,3,4,...

But with variations in speed of execution, the order will be garbled.

If you want them to be sorted, sort them. But there's a throughput cost to doing so.

It does not matter that they're out of order. The definition of a surrogate key is that it provides uniqueness, nothing more. Nor can you control the order of storage in a database table - it will put rows wherever it decides to.

For the same reason gaps in sequences of surrogate keys, caused by different numbers of rows processed on different nodes (probably because of the partitioning algorithm selected) do not matter either.