Historical data and redundant fields in the database

Source: Internet
Author: User

According to the actual business needs, many of the data need to be permanently saved, and not with the subsequent changes in the data to affect other data, for example, the e-commerce system of orders, the order includes the price of the goods you bought 100,n days a May fall to 90, then your order price will be 90? How to solve? My answer is: Add the Price field directly in the order table and write the price every time the order record is generated. I think if a field like "price" is too much, consider creating a new one to store the history table. It is important to note that the "price" here is not the so-called redundant field when we are designing the database. Redundant fields say for the efficiency of the system to sacrifice some of the inverse paradigm design of the space, it is characterized by following the change of the main table changes, in this case if the "price" is a redundant field then it will change with the price of the commodity, which is obviously not the result we expect. So historical data, redundant fields must be based on our actual business to make the most reasonable design.

Historical data and redundant fields in the database

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.