When you have values which only depends on one or more other fields +/- constants (say retail price & discount price), is it better to store those values too or to calculate them "on the fly" when retrieving the data?
The default is not to store redundant information: the third normal form is usually a sensible initial goal. Redundancy is introduced when a "good enough" reason appears, such as a "big enough" performance hit you take when you have to calculate a derived value and the calculation is intensive.
Obviously, "good enough" and "big enough" are qualifiers which only mean something in a given context. For what it's worth, the retail/discount price calculation seems too cheap and simple to do to warrant the introduction of a redundant column in most (obviously not all) cases.
I would agree with Tomislav - try to avoid redundancy because you can end up with data on multiple tables disagreeing with each other. It makes updates more painful.
There are exceptions that are worth considering, though, that are not related to database performance.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With