Database Çeku, sub-Libraries, sub-tables

Source: Internet
Author: User

Basic and practical application of Çeku-read/write separation:

There are two ways to facilitate read and write separations:

1. Dynamic Data Source switching

It refers to the dynamic weaving of the data source into the program when the program is run, so that the specified program connects to the main library or from the library

Custom Annotations Complete database Çeku

2. Direct definition of data source and write data source

Directly in the project to define two database connections, one is the main library connection is from the library connection, update the data when we read the main library connection, query data when reading from the library connection

Differences between multiple data sources (ÇEKU) and sub-Libraries:

They are all at the bottom of multiple databases in the service provided.

The Sub-Library belongs to the micro-service application split when all have their own database, and the multi-data source is not applied to split the time has been divided into two libraries, according to the business use different code to connect to different databases.

easy support for multiple data sources

Database sub-tables:

When do you think about the sub-table?

When a data table is large enough that we do SQL and index optimizations, the speed of the basic operation is still affected, and we have to consider the sub-table

  Benefits of the sub-table:The concurrency of the single table after the table is improved, and the efficiency of writing operation is improved. Second, the query time is short, the data distributed in different files, the disk IO disk IO Performance is also improved, the disk read-write lock affect the data is small, inserted database need to re-establish the index less. Sub-table policy:A horizontal table distributes different rows of data in a table to a different database table (these tables are stored in the same database), which reduces the amount of single-table data and optimizes query performance. Vertical sub-tableIt is generally divided according to the activity of the data. MyBatis Sub-table plug-in shardbatis2.0

Database Çeku, sub-Libraries, sub-tables

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.