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 Vertical Library Division in MySQL

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

Share

Shulou(Shulou.com)05/31 Report--

MySQL how to achieve vertical sub-library, I believe that many inexperienced people are helpless about this, this article summarizes the causes of the problem and solutions, through this article I hope you can solve this problem.

horizontal subscale

As the name suggests, horizontal table is to cut the data in the table horizontally, which means cutting according to rows, that is, the data of different rows may be cut in different tables.

As shown in the figure, according to the horizontal cut, the data rows with id 1 and 2 will be in one table, the data rows with id 3 and 4 will be in one table, and the data with id 5 will be in one table. This is the horizontal table.

vertical table

The same is true, it means that the data table has been divided vertically, and the columns in the original table have been divided into different tables.

As shown in the figure, the desc field is cut and assigned to another table. So why vertical sub-table, or under what circumstances suitable for vertical sub-table? The answer is that the purpose of vertical table is to separate the fields containing a large amount of data in the table, such as text field and blob field from the table, which can greatly reduce the data pressure of the original table, and the access volume of these fields is not as high as that of other fields, so this processing is appropriate.

horizontal sub-library

If you understand the horizontal and vertical tabulations above, you will also understand the partitioning of the database. As the name implies, horizontal sub-database is equivalent to cutting the database horizontally. The data in the original table may be allocated to different databases. This is horizontal sub-database.

As shown in the figure, the data in table1, table2, table3, and table4 are all horizontally cut, so that the data in a table may be distributed to different databases.

vertical depots

Vertical sub-database, that is, the database will be vertically divided, this time the data in a table will not be allocated to different databases, but different tables may be allocated to different databases.

As shown in the figure, table1 and table2 are divided vertically into one database db1, while table3 and table4 are allocated to another database db2.

When is the vertical division? The answer is segmentation based on business logic. For example, we can assign user tables and user-related tables to the user database, and commodity tables and commodity-related data to the commodity database.

After reading the above content, do you know how to achieve vertical partitioning in MySQL? If you still want to learn more skills or want to know more related content, welcome to pay attention to the industry information channel, thank you for reading!

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