On Sat, Sep 5, 2009 at 8:42 AM, Metin Akat<[email protected]> wrote: > On Sat, Sep 5, 2009 at 10:20 AM, Chris Anderson<[email protected]> wrote: >> On Fri, Sep 4, 2009 at 11:34 PM, Metin Akat<[email protected]> wrote: >>> One way I can think of is to bulk update all transactions "belonging" >>> to a leaf account when moving that leaf account around. >>> I can live with having to wait some time till this gets executed. >>> Is this "bad thinking" or is it OK to some extent? >>> >> >> It can be problematic if you need ACID compliance as bulk updates >> aren't transactional. (Especially consider what can happen during >> replication.) >> >> This can often be remedied in your app model, but this is can get complex. >> > > So this probably means that the least problematic way to go would be > if I calculate aggregate balances client side. > OK, for now I don't plan having millions of accounts, so I'll choose > this way after all. >
Why not record the account hierarchy with each transaction and think of that as a snapshot of the hierarchy when the transaction occurred? You get a little extra historical data that way. You can emit a view row for every account in the lineage so that when you calculate account balances you only need to use the account id as the key. So it does not matter if the hierarchy in the transaction does not match the current hierarchy.
