Should I store a calculate value in my database along with the variables?

前端 未结 5 833
囚心锁ツ
囚心锁ツ 2020-12-31 07:00

In all the applications I have made where a database is used I typically store the calculated value along with the variables needed to calculate that value. For example, if

5条回答
  •  无人及你
    2020-12-31 07:36

    The standard approach is not to store this kind of calculated values - it breaks normalization.

    There are cases you want to store calculated values, if it takes too long to recalculate, or you are running a data warehouse etc. In your case, you want stick to the normalization rules.

提交回复
热议问题