Database redundancy fields and suitability, database redundancy Fields

Source: Internet
Author: User

Database redundancy fields and suitability, database redundancy Fields

In my personal opinion, a redundant field is a field that exists in one table and also appears in another table.

For example, there are three tables: User table, product table, and order table. The user table has a field name, and the order table also has a field name.

Good or bad for this field Redundancy

Good:

Starting from the user table, product table, and order table, when I want to query all the data in the "Order table" and only need the name of the "user table", the database connection is generally allowed) query,

For example, the "Product table" has a field --> User id, and the "Order table" has a field --> product id. I can query all orders and query the corresponding product by the product id in the order, then query the user name,

If there are more than one table, for example, 1000 tables ("a little exaggerated, please forgive me"), in order to get the name in a user table, the query speed can be imagined.

Add a field name to the order table, and query the order directly to complete the requirement, which is simple and clear.

Bad:

Same as above. In this case, you need to add, delete, and modify the User name field. In this case, you also need to know the redundant fields in all tables to prevent the fields in some tables from being modified.

To address this problem, we recommend that you add redundant fields if the impact is not significant and is conducive to development efficiency.

Note: This is the first time that Tom wrote a blog. Some examples may not meet the actual development requirements. Please forgive me.

Copyright Disclaimer: This article is an original article without code and cannot be reproduced without permission.

 

Related Article

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.