I would like to ask MySQL to divide the table by month, and the engine is InnoDB.

I have a blank table in the database. Please give me some advice.

Mar.26,2021

two methods
1. Horizontal sub-table
is a table with a large amount of data, which can be dispersed into different tables according to hash or certain rules
2. Vertical sub-table
is to divide a table with a large number of fields into multiple tables and then associate them with


upstairs. Choose vertical or horizontal according to the demand. For example, log tables are suitable for date-based partition rules (most, a small number of log tables may not be. ). If it is some common data, it can be divided according to the field. As for the
sub-table rule, I personally implement it programmatically, because my table is divided according to the date rule, so I get the data by generating the program and looking up the table name. If it is a field split table, you can write the corresponding view in the database, and just call the direct view to call it.


just partition directly. The sub-table is similar to the kind of read-write separation. You can use something like

directly.
Create table user( id tinyint(3) not null primary key, name char(30) not null comment  '' )
partition by range(id)( partition id01 values less than (10), partition id02 values less than (20), partition id03 values less than maxvalue); 
Menu