Subject | Re: [firebird-support] Re: max() on primary key very slow |
---|---|
Author | Woody |
Post date | 2012-02-10T20:20:57Z |
From: "Leyne, Sean" <Sean@...>
merely offering a solution that is independent of any database design. Just
a different way of solving the problem.
Woody (TMW)
> Woody,Of course they are a better idea, but not all databases support them. I was
>
>> Since you control all the access, why not create an ID table that holds
>> the
>> next ID for each table instead of relying on the speed of MAX? It's no
>> more
>> dangerous in a multi-user environment and as a matter of fact, given the
>> proper attention to locking, is much safer and easier to deal with. I do
>> this
>> with many of my relations and have never had any problems with multiple
>> users. It also eliminates any speed issues no matter which database you
>> use.
>> :)
>
> That would approach could introduce transaction concurrency issues.
>
> As Ann has pointed out, generators/sequences are a much better approach.
merely offering a solution that is independent of any database design. Just
a different way of solving the problem.
Woody (TMW)