MYSQL5.5表分區問題 1.字段屬性為timestamp,在分區時出現異常 Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed 網上找了下好像是說timestamp類型分區時不起作用要改成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.修改為datetime後出現錯誤提示如下 A PRIMARY KEY must include all columns in the table's partitioning function mysql分區字段必須包含在主鍵中 sql如下:
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) );