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
1. Download the installation package Download add...
According to canisue (http://caniuse.com/#search=...
Create an HTML page with an unordered list of at l...
1. Configuration By default, the first two are no...
This article example shares the specific code of ...
I was bored and suddenly thought of the implementa...
SSH stands for Secure Shell, which is a secure tr...
Recently, https has been enabled on the mobile ph...
Solve the problem of eight hours time difference ...
I don't know if you have ever encountered suc...
Table of contents Overview 1. Path module 2. Unti...
Hide version number The version number is not hid...
Preface The project requirement is to determine w...
Table of contents Preface 1. Basic knowledge of d...
1: Baidu website login entrance Website: http://ww...