> PS: I don't want to compute "balance" attribute by code and save it in op
> balance due to the fact that I am using an undo/redo mechanism.

>From my experience this is the only way to go - calculate the balance
in your application then store it in database along with transaction
as "balance after this transaction". Yes, you would have to update
many rows during any undo/redo operation but otherwise you will wait
too long to calculate balances on the fly. You can implement some
interim solution which will calculate balance say for the end of each
month. So to calculate current balance you'll have to take record for
the end of previous month and add all transactions for the current
month...


Pavel

2010/6/1 Stéphane MANKOWSKI <steph...@mankowski.fr>:
> Hi,
>
> In the this database file (http://skrooge.org/files/test.wrk), I created a 
> table
> named "op" containing banking
> transactions.
> A transaction has:
>        An unique id
>        An account
>        A date
>        An amount
>
> I created a view named "v_op" with one more computed attribute named
> "balance".
> This attribute is the sum of all previous transactions (including current one)
> for the same account.
>
> My problem is that v_op is very slow. This is not usable.
>
> What can I do to improve performances ?
>
> PS: I don't want to compute "balance" attribute by code and save it in op
> balance due to the fact that I am using an undo/redo mechanism.
>
> Regards,
> Stephane
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to