dbTalk Databases Forums  

DB_RECNUM used for "auto-incrementing" style field

comp.databases.berkeley-db comp.databases.berkeley-db


Discuss DB_RECNUM used for "auto-incrementing" style field in the comp.databases.berkeley-db forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
tegonzalez@gmail.com
 
Posts: n/a

Default DB_RECNUM used for "auto-incrementing" style field - 08-21-2006 , 11:02 PM






I'm interested in accessing records in a bdb using an integer-based
index. I can either:

1) Utilize bdb's DB_RECNUM flag available via Db::set_flags to uniquely
address records
-or-
2) Maintain an integer field as the key and track the maximum value per
table to implement an relational db style auto-incrementing field

#1 seems like the likely candidate, however, I see options like the
flag DB_RENUMBER which could completely dissolve any relationships
based on a "foreign-key" reference to that field.

My questions are:
1) Is it safe/advisable to use the RECNUM like a primary key? (ie.
storing this number in other db's data segments)
2) Are there any standard bdb operations (ie. compact, dump, load,
etc.) which would loose or disrupt a db's record numbers and make db
relationships inconsistant?
3) What is the upper limit on record numbering per db (~ 32-bit
integer?) and is there a well-documented/known technique for recycling
RECNUMs that have been removed (/archived)?

It may be assumed that records in these dbs will go thru the standard
insert, update, and delete operations. It is fine to have gaps in the
sequence, but it must be possible (and efficient) to maintain
consistancy across "child" dbs by propagating any RECNUM changes to
linking fields.

Thanx,

-Tomas


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.