Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize horizontal subtable in mysql

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report