Vertical Split Vertical splitting refers to the splitting of data table columns, splitting a table with many columns into multiple tables
Columns that are frequently queried in combination are placed in one table;
Horizontal Split Horizontal splitting refers to the splitting of data table rows. When the number of rows in a table exceeds 2 million, the processing will become slow. At this time, the data of one table can be split into multiple tables for storage. Some tips for horizontal splitting 1. Split principle Usually, we use the modulus method to split the table; for example, a user table with 4 million users is divided into 4 tables to improve its query efficiency.
By using the ID modulus method, the data is distributed into four tables. Id%4+1 = [1,2,3,4] Then query, update, and delete are also queried by taking the modulus method $_GET['id'] = 17, 17%4 + 1 = 2, $tableName = 'users'.'2' Select * from users2 where id = 17; When inserting, a temporary table uid_temp is also needed to provide an auto-incrementing ID. The only use of this table is to provide an auto-incrementing ID. insert into uid_temp values(null); After getting the self-incrementing ID, the sub-table is inserted through the modulo method;
in addition
Create view users as select from users1 union select from users2 union......... The above are the details of vertical splitting and horizontal splitting of MySQL tables. For more information about MySQL table splitting, please pay attention to other related articles on 123WORDPRESS.COM! You may also be interested in:
|
<<: Native JS object-oriented typing game
>>: How to configure port forwarding for docker on CentOS 7 to be compatible with firewall
As the computer is used, a lot of garbage will be...
1. Environment VS 2019 16.9.0 Preview 1.0 .NET SD...
1. Import csv file Use the following command: 1.m...
Problem Description After installing the plugin E...
Table of contents 1. Introduction 2. Scenario 3. ...
Preface: One day, I built a MySQL service in Dock...
Preface Tip: Here you can add the approximate con...
This article describes the linux system commands....
Table of contents 1. Offline installation 2. Onli...
As one of the most popular front-end frameworks, ...
background When we talk about transactions, every...
Prerequisites 1. Docker has been installed on the...
Aggregate functions Acts on a set of data and ret...
The following is my judgment based on the data st...
After obtaining the system time using Java and st...