Subject | Re: FOR SELECT .. DO .. UPDATE is slow |
---|---|
Author | clementdoss |
Post date | 2004-07-19T18:33:11Z |
--- In firebird-support@yahoogroups.com, "Epstein, Ed"
<eepstein@c...> wrote:
(YES/NO)
Neither of those fields are indexed :-(
and int_mov_id is a primary key field.
The update should be very fast.
Clément
<eepstein@c...> wrote:
> >>FOR SELECT int_mov_id,statement.
> mny_credit,
> mny_debit,
> mny_balance
> from TB_MOV
> where BLN_CALC = 'N'
> into :MovID , :Credit, :Debit, :Balance
> DO BEGIN
> NewBalance = OldBalance + Credit - Debit;
>
> update TB_MOV set
> mny_balance = :NewBalance,
> bln_calc = 'S'
> where int_mov_id = :MovID;
>
> OldBalance = NewBalance;
> END;
> >>
>
> think about is the WHERE BLN-CAL = 'N' condition on your select
> Is that field indexed? That could affect speed.No. BLN_CALC is not indexed because the only values allowed are S/N
(YES/NO)
>longer
> Also, if your update is changing an indexed field that will take
Neither of those fields are indexed :-(
and int_mov_id is a primary key field.
The update should be very fast.
Clément