Get the App
SLTechnology News&Howtos  ›  Database  › 

How to realize horizontal subtable in mysql

Shulou Source: shulou.com Published: 2022-06-01 03:30:00 10月29日 Update

How does mysql achieve horizontal sub-table? This problem may be often seen in our daily study or work. I hope you can gain a lot from this question. The following is the reference content that the editor brings to you, let's take a look at it!

Mysql table data generally reach the level of millions, query efficiency will be very low, easy to cause table locks, or even pile up a lot of connections, directly hang up; horizontal sub-table can greatly reduce these pressures.

Horizontal subtable:

As shown in the figure above: the other three tables have the same structure, except that the data are stored in these three tables separately. If you want to insert or query, then you need to take the remainder of the id and then concatenate the table name, then it is a complete table_name.

But what if I need to sub-table name or email?

Then you need to use MD5 for encryption because after MD5 encryption is hexadecimal, then you can take the remainder, the idea is the same as above.

Put rows of data into two separate tables based on the values of one or more columns of data.

Split horizon is usually used in the following cases.

The table is very large, and after segmentation, it can not only reduce the number of pages of data and index that need to be read in the query, but also reduce the number of layers of the index and improve the query speed.

The data in the table is inherently independent, for example, data from different regions or different periods are recorded in the table, especially some data are commonly used, while others are not commonly used.

Thank you for reading! After reading the above, do you have a general understanding of how mysql implements the level sub-table? I hope the content of the article will be helpful to all of you. If you want to know more about the relevant articles, you are welcome to follow the industry information channel.

Tags: Data table level content query large commonly used article index question encryption independent different above figure two pressure but at the same time region that is Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia OPPO Reno Shulou Tech Info MySQL MariaDB