Best way to maintain a customer's account balance

前端 未结 8 632
孤独总比滥情好
孤独总比滥情好 2021-02-06 10:24

Is it better to have a field in the database that stores the customers account balance or use views and queries to generate the information.

8条回答
  •  旧时难觅i
    2021-02-06 11:03

    For performance, I'd say both. Keep a log of all the transactions (in a separate table) but maintain a field in the customer record that stores the current balance that gets refreshed when you add more transactions.

提交回复
热议问题