OODB Storage Options and Performance

Marten Feldtmann m.feldtmann at t-online.de
Thu Apr 14 07:14:39 UTC 2005


Some people name it modified "high-low" algorithms. I've seen this
kind of ID generation in some OO-RDBMS mapping tools, which
were written in Smalltalk. Though the algorithm are database based
(they need a special table), I've used this algorithm also in a Smalltalk
based server, which hold the needed numbers in RAM or in  a
simple file.

In general:

a) We have a set (table) of Array of two values (colums). One value
is a session value, the other one is a "running" index.

b) The set is initialized with the pair [1 0]. (1 = session, 0 = running)

c) Whenever a client needs a pair to generate local ids he queries the
server (database) for a pair of values:

c.1) If we have several pair of values within this set we take the pair
with the lowest session value.
c.2) If the client takes the last valid pair (from the set) he has to
generate a new valid pair (for the next client). The new one is
generates via [(retrieves session value + 1) 0 ]. This must be
unique, because nobody has ever used this session id before.

d) If you have a nice client and theapplication quits it gives it actual
pair of values back to the server (database) (increase running value
by one) to reuse the session key for the next client.

e) In addition some frameworks generate a unique key per class. Then
you have three integer values, convert them to base 36, put them
all together and you get a unique key consisting of  (3 + 6 + 6)
based-36 digits.

This means: you have ONE communication at the beginning of your
application (or: "lock table", "select", "insert or delete") and one
communication at the end of your application ("insert").

This structure is *very* database dialect independent.


A very detailed description can be read (in German) in
G. Wanner,  1998, 3-89601-446-3, DISBIS 46,
Entwurf eines objektorientierten Datenbankmodells für relationale 
Datenbanksysteme

This german book describes a Smalltalk based relational database
wrapper system - very interesting description .

Marten Feldtmann

Daniel Salama schrieb:

> Could  you provide reference(s) to such algorithms?
>





More information about the Squeak-dev mailing list