Q: How to minimize the impact of modifying table structures on existing programs in the later stages of development

  1. Table design is to reserve a field with no business significance, such as userFiled1, userField2,…, for easy mapping with specific business fields in the future
  2. Design a special field to store an XML file, which contains custom structures for easy system expansion. Accessing requires parsing XML strings
  3. By mapping physical table structures and object logical structures like Hibernate. The modification occurred in the physical table structure and hibernate mapping text
    In Java classes, table and field names are defined using immutable strings. Like
1
2
3
public const String CUSTOMERS_TABLE = "Customers";     
public const String EMAIL_FIELD     = "Email";    
public const String NAME_FIELD      = "Name";    

This modification only occurs in a small number of places.

Q: How to improve performance

  1. For special business needs, such as reconciliation and settlement of payment platforms, create a shadow table (such as paymentShadow) with redundant fields from other related tables. By using this method to reduce associated queries and improve efficiency.
  2. Not setting foreign keys or even primary keys is a bit like the No SQL approach, but it has indeed been encountered in commercial application systems.