Subject | Re: [firebird-support] FOR SELECT .. DO .. UPDATE is slow |
---|---|
Author | Milan Babuskov |
Post date | 2004-07-19T21:11:20Z |
Epstein, Ed wrote:
My ideas:
create index on TB_MOV.int_mov_id if it doesn't exists.
remove index on TB_MOV.bln_cals it it does exists.
--
Milan Babuskov
http://fbexport.sourceforge.net
>>>FOR SELECT int_mov_id,Strange thing... Variable "Balance" isn't used at all?
>
> 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;
> If the update has been removed and it is still slow the only thing I canIt would brobably slow it down since it has low selectivity.
> think about is the WHERE BLN-CAL = 'N' condition on your select statement.
> Is that field indexed? That could affect speed.
My ideas:
create index on TB_MOV.int_mov_id if it doesn't exists.
remove index on TB_MOV.bln_cals it it does exists.
--
Milan Babuskov
http://fbexport.sourceforge.net