Subject | Re: [ib-support] sharing generators between tables |
---|---|
Author | Doug Chamberlin |
Post date | 2002-02-03T14:27:15Z |
At 02/03/2002 01:45 AM (Sunday), csswa wrote:
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.
>Are there any drawbacks to sharing a generator between several tablesThere is only one minor consideration which I have encountered.
>for PK generation?
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.