MYSQL5.5 table partition problem bitsCN.com
Partitions in MYSQL5.5 tables
1. The field attribute is timestamp, and an exception occurs during partitioning.
Constant, random or timezone-dependent expressions in (sub) partitioning function are not allowed
I found it online. for example, if the timestamp type partition does not work, it should be changed to DATETIME or DATE.
Pruning is not expected to work for tables partitioned on a TIMESTAMP column, and you should use a DATETIME or DATE column for this instead.
2. if it is changed to datetime, the following error occurs:
A primary key must include all columns in the table's partitioning function
The mysql partition field must be included in the primary key.
The SQL statement is as follows:
Alter table Test partition by list (dayofweek (time) (PARTITION p01 values in (1), PARTITION p02 values in (2), PARTITION p03 values in (3 ), PARTITION p04 values in (4), PARTITION p05 values in (5), PARTITION p06 values in (6), PARTITION p07 values in (7 ), PARTITION perr values in (0 ));
BitsCN.com