Collation of database design principles (continuous update)

Database design and data business principles (rectification principles)

Business sustainability is generally fully reflected in the design of the database. Therefore, when we design the database, we generally follow the established principles and carry out continuous updating and design to ensure sustainability and maintainability.

  1. Combined with the existing business, fully consider business expansion, use this as the basis for database design, and plan the design principles.
  2. Database design is not a one-time project that needs to be gradually improved in practice. The key point is to discover good principles, establish principles, and abide by principles.
  3. If there are more than 30 fields in the main table, you can consider splitting the extended table, splitting common fields and uncommon fields
  4. Commonly used unique attributes of users can be designed as redundant fields for maintenance
  5. When the database (table, field) is created, the field must have a default value (null value is not used), andwrite notes
  6. When it is necessary to create a flow table for related businesses, the flow table is generally recorded in conjunction with the fields of the main table. There are always comprehensive fields corresponding to it in the main table, and the field maintenance is done well in the program.
  7. Since the data volume of the flow meter is generally too large, the flow meter is basically only responsible for data review, and the latest record display,Not responsible for comprehensive statistics and data details business processing
  8. The water meter should be subdivided in advance to be compatible with business expansion requirements
  9. Design the database structure of master-slave replication. For the display of data details (reading a large number of flow table data), it is necessary to read from the library instead of the main library. At the same time, consider data cache design and segmented reading.
  10. According to the query business logic, establish a good table index. When there are more than 5 indexes, you need to consider the possibility of conditional combination, and follow this principle for program design

The above are my impressions, not perfect, some have been verified by actual operation, some have not, and I plan to continue to update. I hope that those who have opinions can give advice, thank you.

Guess you like

Origin blog.csdn.net/qinmin1/article/details/88901908