MySQL按哈希月份/年份更改表分区-Error。主键必须包含表分区功能中的所有列

时间:2019-12-11 09:11:40

标签: mysql large-data database-partitioning

我有一个MySQL表(包含大数据):

CREATE TABLE `rider_orders` (
  `id` NOT NULL AUTO_INCREMENT PRIMARY KEY,
  `date` date NOT NULL,
  `shift_id` INT NOT NULL,
  `rider_id` INT NOT NULL,
  `product_id` INT NOT NULL
)

我想按月(通过更改)添加分区:

ALTER TABLE rider_orders
  PARTITION BY HASH(MONTH(date));

0 个答案:

没有答案