Subject Re: "Generators" via table data
Author Adam
--- In firebird-support@yahoogroups.com, "tdtappe" <tappe@...> wrote:
>
> I would love to hear your opinion on this:
>
> I need to have generators or let's say counters as table data, not
> metadata.
> Why? Because it depends on how the user sets up my application.
> So for example I don't know how many counters I need to have.
>
> So let's assume I have a table that contains all counters and each
> counter is referenced by a unique name (primary key).
>
> What would be the best way (performance) to implement a counter
> increment. Of course, a client application must not get a counter value
> that another client has already got. Just the way generators work in
> firebird.
>
> Is for example using WAIT transactions the way to go?
> Or how would I implement something like a queue (if neccessary) to get
> the next counter value? Otherwise it might be possible that one client
> keeps getting deadlocks while trying to "get access" to the counter
> record.
>
> BTW, I use Firebird 1.5, Delphi 2006 and UIB components.
>
> --Heiko
>

Hello Heiko,

How dynamic is this user setup? I mean after the initial setup, is
there lots of changes, or is it reasonably static? How many 'counters'
are required

The problem with using a table is just as Ann has pointed out, you
serialise your inserts.

If it is possible, I would create a naming convention for the
generators and have your application create one generator per counter.
The number of generators is finite, so you may want to confirm that
you are not going to 'run out'.

Adam