Subject | Re: [firebird-support] Re: max() on primary key very slow |
---|---|
Author | Mark Rotteveel |
Post date | 2012-02-11T17:08:28Z |
On 11-2-2012 18:05, Kjell Rilbe wrote:
NEW."LastUsedId") to get it in one go.
--
Mark Rotteveel
> Enter one row in this table for each table you need a PK "generator"You could UPDATE .... RETURNING "LastUsedId" (or explicitly
> for. To aquire a key, start your transaction with:
>
> update "PK"
> set "LastUsedId" = "LastUsedId" + 1
> where "TableName" = :TableName
>
> Then
>
> select "LastUsedId"
> from "PK"
> where "TableName" = :TableName
NEW."LastUsedId") to get it in one go.
--
Mark Rotteveel