Some problems caused by sub-database and sub-table

  • Data
    sub-library sub-table concept and application scenarios Detailed
    sub-library sub-table brought some problems
    sharding-jdbc horizontal and vertical sub-library sub-table environment to build
    sharding-jdbc level sub-library sub-table real
    sharding-jdbc sub-library sub-table vertical combat

  • Distributed transaction problem
    The transaction of the database is only effective locally, which can ensure that the operation of the node itself is a transaction. When there are multiple databases, the databases are invisible, so there is a problem of data inconsistency when the database is divided.

  • Cross-node associated query problem
    When vertical sub-database, for example, order and payment are different modules, then at this time, if you want to view order details, then you need to associate query, then you can no longer use join directly like a single database to achieve expectations. Effect

  • Cross-node sorting, paging, max, min, count and other issues.
    When horizontally splitting the database, each database node saves a part of the data, so sorting, paging, max, min, count are operations on the overall data, and It can't be solved by using order by, limit, max, min, count(*) directly like a single library

  • The problem of primary key duplication.
    When horizontally sub-table and sub-database, the primary key generation strategy is useless, and horizontal sub-database sub-table cannot rely on the primary key generation strategy of the table itself, otherwise duplication is likely to occur

  • Common table problems
    Some function tables, such as some constant tables, are used by multiple database nodes, but there is no need to sub-database and sub-table

  • Summary
    Although sub-database and sub-table can solve the database performance problem for us, it will also bring us the above five basic problems, which may need to be solved during development. These solutions have helped us solve them at some intermediate prices. We only You need to use these intermediate price schemes.

Guess you like

Origin blog.csdn.net/weixin_38312719/article/details/109134841