我有下表。
我也想添加分区。
CREATE TABLE `app_log_Test` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`dateCreated` datetime NOT NULL,
`host` varchar(512) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`label` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`event` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`level` varchar(8) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`message` text COLLATE utf8mb4_unicode_ci,
`version` bigint(20) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `app_log_dateCreated` (`dateCreated`),
KEY `app_log_label` (`label`),
KEY `app_log_event` (`event`),
KEY `app_log_level` (`level`)
) ENGINE=TokuDB `COMPRESSION`=tokudb_quicklz
我正在使用 MariaDB 10。
MariaDB [test2]> alter table app_log_Test partition by RANGE(TO_DAYS(dateCreated))(
-> PARTITION p_201809 VALUES LESS THAN (TO_DAYS('2018-09-01 00:00:00')) ENGINE = TokuDB,
-> PARTITION p_201810 VALUES LESS THAN (TO_DAYS('2018-10-01 00:00:00')) ENGINE = TokuDB);
我收到以下错误
ERROR 1503 (HY000): A PRIMARY KEY must include all columns in the table's partitioning function