Re: Stupidity or sequences?

  • From: Dba DBA <oracledbaquestions@xxxxxxxxx>
  • To: ORACLE-L <oracle-l@xxxxxxxxxxxxx>
  • Date: Tue, 23 Apr 2013 10:05:06 -0400

ok. So CURRVAL won't actually serialize access to the object? 1 session can
execute a CURRVAL and another can execute a NEXTVAL simulatenously? That
makes sense. This tells me that the 'latch' is on the SET function and not
on the struct itself. As far as the latching goes, I would guess it just
uses the C language built in for this. I forget the syntax, but every low
level language can serialize access.
@wblanchard: Yeah thanks. I think most languages have that. That being
said, you generally have more application servers than you do database
servers, so you would need to instantiate an object for each application
server. I think this would be the same thing that RAC does. With an index
setting of cache 500, each RAC server reserves 500 concurrent numbers. So
if you have 10 application servers, each one would need its own object.

I don't think this would take alot of fancy code to re-create. That being
said, it is still extra code and only worth the effort if you sell some
kind of off the shelf application that runs on client databases and for
business reasons you don't want to restrict yourself to clients who only
use oracle. I agree with the original poster that the implementation that
most of these java guys come up with are pathetic. They don't appear
competent enough to do this well. There is a very good software blog called
'joelonsoftware.com'. There is an older blog post called 'The Plight of
Java Schools', where he argues that developers should learn C in school and
you can learn java later on. Java guys don't learn these kinds of
algorithms and are not qualified to implement them. When I work with C
programmers they tend to have the same complaints about java developers
that DBAs do.



CURRVAL, however, won't access the SGA structure, it will need to reference
> the local memory location populated by the previous call by the session to
> NEXTVAL.
>
>
> Regards
>
> Jonathan Lewis
> http://jonathanlewis.wordpress.com/all-postings
>
> Author: Oracle Core (Apress 2011)
> http://www.apress.com/9781430239543
>
> ----- Original Message -----
> From: "Dba DBA" <oracledbaquestions@xxxxxxxxx>
> To: "ORACLE-L" <oracle-l@xxxxxxxxxxxxx>
> Sent: Monday, April 22, 2013 9:29 PM
> Subject: Re: Stupidity or sequences?
>
>
> | 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  = ....
> | commit;
> |
> | 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
> |
> |
> | --
> | //www.freelists.org/webpage/oracle-l
> |
> |
>
> --
> //www.freelists.org/webpage/oracle-l
>
>
>


--
//www.freelists.org/webpage/oracle-l


Other related posts: