Patent ID: 8180748

Claim:
A computing system comprising: a processor; and one or more storage medium storing computer-executable instructions which, when executed by the computing system, implement a method performed by at least a surrogate key domain component that is executed by processor for generating surrogate keys using a surrogate key domain table that is stored in a database, wherein the method comprises: sending a first request to the surrogate key domain table for a first quantity of surrogate key values; in response to the request, acquiring a lock on the surrogate key domain table, the surrogate key domain table comprising a database object in the database, the surrogate key domain table including values representing an increment, a current seed, and a cache size to be used by the surrogate key domain component to generate surrogate keys to assign to records that are to be inserted into the database; upon acquiring the lock on the surrogate key domain table, querying the surrogate key domain table for the increment, the current seed, and the cache size; receiving an identity of a first starting value as identified by the current seed; reserving a first sequence of the first quantity of surrogate key values by performing the following: assigning the current seed to a current key of the surrogate key domain component, the current key representing a current value to be used for the next surrogate key generated by the surrogate key domain component; determining a maximum value for the current key based on the first starting value of the current seed and the cache size; writing a new value to the current seed of the surrogate key domain table, the new value being the sum of the current seed, the cache size, and the increment; and wherein the method further comprises: for each particular record of a set of records to be inserted into the database, performing the following: creating a record key, which comprises one of the generated surrogate keys, for the particular record and that is equal to the new value of the current key; incrementing the new value of the current key by the increment; and inserting the particular record into the database; thereafter, determining whether the new value of the current key is less than the maximum value; upon determining that the new value of the current key is less than the maximum value, querying the surrogate key domain table for the current value of the current seed; comparing the current value of the current seed to the new value that was written to the current seed previously to determine whether another process has obtained the increment, the current seed, and the cache size from the surrogate key domain table since the surrogate key domain component obtained the increment, the current seed, and the cache size; and upon determining that the current value of the current seed is the same as the new value, writing the current value of the current key to the current seed thus allowing any unused values from the first quantity of surrogate key values to be subsequently used as surrogate keys.