Sample Header Ad - 728x90

How do I add a partition to an existing table in mariadb / mysql?

5 votes
1 answer
25849 views
I have the following table. I want to add partitions too. 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 I am using 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); I get the following error ERROR 1503 (HY000): A PRIMARY KEY must include all columns in the table's partitioning function
Asked by nelaaro (767 rep)
Oct 10, 2018, 11:49 AM
Last activity: Oct 22, 2018, 12:51 PM