Subject Re: [firebird-support] Re: Hundreds of Generators
Author Ann W. Harrison
zvjezdantomicevic wrote:
> Just from top of my head:
> How about creating table
> ITEM_ID int
> YEAR int
> COUNTER int
> and use triggers.
> If record for that year does not exist,insert it with counter 0,
> and if it does, increase counter by 1 using trigger.
>
> You have if exists, insert or update statements, and before insert/update triggers at your disposal to do this.
>

The table would take more space than the whole set of generators,
and it would produce deadlocks if two people tried to create identifiers
at once, and even if it were never updated concurrently, the lookup
and update/insert is much more computationally costly than using a
generator.

What problem are you trying to solve?


Cheers,

Ann