Re: Stupidity or sequences?

From: Dba DBA <>
Date: Mon, 22 Apr 2013 16:29:45 -0400
Message-ID: <>

does anyone know what oracle does under the covers to guarantee uniqueness of the sequence? When you cache sequence values in memory (say 500) per node... I am guessing they use a struct to store the current value. In java/c there is a way to make a method/class/struct serialized so only 1 session at a time can get the value. I doubt its anything fancy. I am guessing the basic algorithm for a sequence with cache 500

Pseudo code below
select sequence_value
from sequence_table_in_data_dictionary
where sequencename = ....

update sequence_table_in_data_dictionary set sequence_value = old_value+500
where sequence_name = ....

Then in memory, each sequence gets its own C Struct (below SQL layer) struct SequenceName serial -- don't remember the C syntax for a Struct or to serialize a struct

   current_value number;
   max_value number --when this hits, find the new value and increment the sequence value in the DB\

Then getter function for CURRVAL and setter function for NEXTVAL

Received on Mon Apr 22 2013 - 22:29:45 CEST

Original text of this message