Storing derived total amount in parent table

  • Hello,

    I've got a typical table design situation where a transaction can be comprised of multiple accounts with each account having a portion of the total transaction amount.

    For example:

    ---Parent row---

    TranID: 7

    Date: 10/10/2008

    Type: Deposit

    Total Amount: $6000

    ---3 Children---

    TranID: 7

    Acct: 15

    Amount: $1000

    TranID: 7

    Acct: 18

    Amount: $3000

    TranID: 7

    Acct: 4

    Amount: $2000

    This is similar to SalesOrderHeader and SalesOrderDetail in AdventureWorks db.

    I'm struggling on whether or not to store the Total Amount in the parent table. Our site is unique in that the transaction amounts are large (>$100M), but the volume is low (<1000 trans per day and only Mon-Fri). Right now, I'm leaning against storing total amount in parent.

    Advice anyone? Pro's and con's?

    Thanks,

    Joe

  • If properly indexed you should be able to sum the details efficiently so there is no reason to store the data in my opinion.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply