Subject Re: [ib-support] sharing generators between tables
Author Doug Chamberlin
At 02/03/2002 01:45 AM (Sunday), csswa wrote:
>Are there any drawbacks to sharing a generator between several tables
>for PK generation?

There is only one minor consideration which I have encountered.

Consider the situation where the generator's current value is corrupted,
changed by mistake, or otherwise lost. What you want to do in this case is
reset it to the highest value already used. That way you can continue to
use the generator normally without the generated values conflicting with
the existing, used values.

If you create one generator for each table it is quite easy to know how to
determine a wrong situation and correct it. I name my generators after
tables in which they are used so this is simple. If you use the same
generator for many tables then somewhere you need to track the
correspondence between which generator is used with which table. A simple
naming correspondence does not work.

Like I said, this is a minor consideration, but life is slightly more
complicated sharing generators.