Subject Re: [firebird-support] Re: Hundreds of Generators
Author Woody
From: "Ann W. Harrison" <aharrison@...>
> Lester Caine wrote:
>
>> Using generators for that does sound something of overkill.
>>
>
> Aside from the fact that the application might try to create
> more than 32K of generators, what's the problem? Generators
> are nearly free in terms of space on disk and much faster to
> generate than numbers kept in a table.
>

All true, but they aren't really safe enough by themselves for auditable
numeric sequences. Decrementing generators because a record is
deleted/cancelled in a multi-user environment is disastrous, as you well
know.

Even though, at the moment, only one person is responsible for new numbers,
that could very well change in the future and should be planned for. In
cases like this, I agree with the premise of keeping the sequence(s) in a
separate table, using locking when updating, along with a second table
containing reusable numbers.

If a value isn't assigned until the record is committed and it can then not
be removed, then generators should serve the purpose just fine.

Just my $0.02

Woody (TMW)