Subject RE: [ib-support] Generating UniqueID [2]
Author Leyne, Sean
Tom,

> 1) using numeric(18,4) or numeric(18,0):
>
> what the difference between these if you look at the generated key as
> an INT64? The key is created with GEN_ID(key, 1), does increment with
> 1, so I guess both are the same if we look at them in function of
> unique keys. But in speed numeric(18,4) is slower? Am I correct?

The performance difference if any, is not measurable.


> 2) Usage of a GUID key:
>
> I see one big benefit in this that even if the database isn't
> reachable, you still generate unique ID's on different PC's.
>
> The possible cons:
>
> 1. I don't see a way on creating it at the moment on database level,
> eg GEN_GUID (I know Oracle has something like that). OR am I wrong
> here? Did somebody already made this in a trigger on
> Firebird/Interbase level?

You can create a UDF for this task -- relatively simple. The need for a
GEN_GUID function, though, has been noted in the Firebird feature
requests.


> 2. Slower than using an INT64 key.

Not, really once the value has been calculated but does depend on the
datatype used to store the GUID value (CHAR(36) vs. CHAR(26) vs. OCTET).


> 3. I suppose it is not OS dependend, or am I wrong here as well?

Not that I'm aware of, the ability to generate a GUID is a function
available with most OSs.


--
Sean Leyne

There is nothing wrong with Interbase,
that can't be fixed with Firebird.
www.FirebirdSQL.org