Subject Re: [ib-support] Generating a unique ID
Author Woody
From: <zifnabbe@...>
> Hi,
> I'm not that very used to DB and I always created an autoincrement
> field as an unique key. But... I know that at a certain moment and
> depending on how many entries a table will get, there is a chance you
> get a numeric overflow... now I'm wondering how is this done in those
> big databases? How is this handled... or is this just not possible
> and do all thos big databases use a combination of fields as a unique
> key?

In interbase and firebird, as well as other DBMS's, "auto-increment" fields
are created using generators and BEFORE INSERT events for the tables. This
serves to keep any two users from getting the same number when inserting
new records. Since the generators reside on the server, it can handle the
traffic required to keep 2 users from getting the same ID.

> Is using a timestamp a good idea?


> Is using a GUID a good idea? How to create a GUID with Firebird?
> Perhaps above suggestions (timestamp, GUID) are stupid ideas, but
> what is the best thing to use as a unique key?

Read up on generators and how to write triggers. That will be the most help
for you.

> Are there also some naming rules concerning tables/fields which are
> interesting to follow by someone who wants to learn something from
> the experience of guru's in the database field?

Don't use field or table names that are the same as keywords, such as DATE,
TIME, etc. Don't put quotes around you names when creating them using DDL as
this will make them case-sensitive and cause you problems down the line.Use
good, descriptive names without getting *too* carried away.