How can I solve the database design confusion?

Source: Internet
Author: User
This is the case of database design confusion. when I was a website, I encountered such problems as "recommendation" and "pin to top, add a field such as "IsTop" or "& quot; IsDelete & quot;" to the table, and use the BOOL type. However, the leaders of the new company did not do this recently. For example, "IsTop" indicates whether to delete the database. it is confusing to create a news database.
This is the case. I used to add a field such as "IsTop" or "IsDelete" to the table when I was a website engineer, use the BOOL type. However, the leaders of the new company did not do this recently. For example, "IsTop" indicates whether to delete the table. it creates a news_delete table, and the record in it is the ID value of "IsTop.

It seems that this operation is also good and convenient to use. To add something similar, you don't have to modify the original table. I would like to ask experts in database design how to be good.

------ Solution --------------------
Everything works. if you think that the data structure is complex, you can design and split the data according to the second method.
------ Solution --------------------
Learn tolerance
There are no rules for your description

The additional attributes are closely related to the basic data.
Obviously, your solution is better than the table sharding solution.
------ Solution --------------------
You can add fields to the current table or create a custom field table to store values. I personally think that each has its own merits. The latter statement is a little more complicated, it is difficult to index, and the search is inconvenient. the join operation is required, and the data increase may cause efficiency problems, but it is more convenient than expansion, the former is simple and violent, making it easy to set indexes for search, but it is difficult to expand the business. it is best to keep both solutions.
------ Solution --------------------
Discussion

Reference:
Learn tolerance
There are no rules for your description

The additional attributes are closely related to the basic data.
Obviously, your solution is better than the table sharding solution.


You mean that my solution has good efficiency and performance and is easy to use. That's right.

------ Solution --------------------
Discussion

Reference:
You can add fields to the current table or create a custom field table to store values. I personally think that each has its own merits. The latter statement is a little more complicated, it is difficult to index, and the search is inconvenient. the join operation is required, and the data increase may cause efficiency problems, but it is more convenient than expansion, the former is simple and violent, making it easy to set indexes for search, but it is difficult to expand the business. it is best to keep both solutions.

Foolbirdflyfirst can ......

------ Solution --------------------
After the problem is solved, paste it. Check your posting rate. 0% posting: 7 normal ending: 0

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.