Subject Re: [firebird-support] Re: Violation of UNIQUE KEY constraint during UPDATE
Author Ann W. Harrison
Milan Babuskov wrote:
> Adam wrote:
>
>>for select id from tablea order by id desc into :id do
>>
>>The idea being to force the order by for the update. I do not know if
>>this would work at all, but may be worth a try.
>
> It would work, but it is more expensive: one full scan (or index walk if
> you have desc index) + pk search for each record.
>
The PK search is quick - and even an index walk to fake a descending
index (less efficient than the sort alternative) is faster than the
double update that was also proposed.

Regards,


Ann