Valentina Database: RecID is Your Perfect Machine

Valentina Database In DepthThe RecID field of Valentina Database performs all of the tasks of a relational primary key (PK) but does so using zero disk space or creation cost.

A perfect machine is a machine that performs its job but doesn’t really exist. There is no overhead cost to using it. Developers choose to use Valentina DB as a solution because of its unique advantages. Let’s take a look at one of those unique advantages.

The RecID field plays the role of a unique identifier of a record in the scope of its table. Let’s take a closer look at what makes this so special in removing overhead in working with large quantities of data.

Anatomy of RecID

Let’s dig into specifics of what the RecID field is.

RecID – Logical Level

  • Each Valentina DB Table have one RecID field
  • RecID plays role of a UNIQUE identifier of a table record
  • Corresponds to 4 bytes ULONG type field, which is read-only
  • We can jump to record with RecID = N directly
  • RecID of a record is never changed during its lifetime (except refactoring commands)
  • RecID value of deleted records can be reused

RecID – Physical Level

  • RecID value is the physical number of a record
  • The first physical record has RecID = 1
  • A deleted record is marked as such in the Bitmap associated with Table? Records are not moved physically

Two Key Advantages of RecID

The overhead savings you get with using Valentina DB’s RecID are profound, especially with the growing overhead cost of using primary keys.

No Storage Allocated for RecID

The RecID field uses zero space and yet still does the same job that relational databases do.  Lets compare with a database table with one million records.

VALENTINA

  • RecID field uses ZERO bytes on disk and in RAM
  • RecID field do not need index, so ZERO bytes

RELATIONAL

  • You use a ULONG field (4 bytes) as Primary Key
  • PK must have index

And the cost of using the relational way…

  • Column data size: 4 bytes * 1million = 4 Mb
  • Index size: (4 bytes of KEY + 4 bytes internal ref) * 1.5 = 12Mb

Not Cost to Create RecID

Each Valentina Table always gets this field automatically.  No effort is required. The best code is no code at all.

VALENTINA

  • CREATE TABLE tblPerson( Name VarChar )

RELATIONAL

  • CREATE TABLE tblPerson( ID ULONG PRIMAY KEY, Name VarChar )

Want to learn more about RecID? Check out the RecID documentation on the Paradigma Software website and feel free to ask questions on the Valentina DB forum.

Leave a Reply