我正在尝试创建下表,
CREATE TABLE IF NOT EXISTS `hashes` (
`hash` binary(20) NOT NULL,
`name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`category` tinyint(1) unsigned NOT NULL DEFAULT '0',
`indexed` tinyint(1) unsigned NOT NULL DEFAULT '0',
`dcma` tinyint(1) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`hash`),
KEY `category` (`category`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci,
PARTITION BY LIST(`category`)(
PARTITION p0 VALUES IN(0),
PARTITION p1 VALUES IN(1),
PARTITION p2 VALUES IN(2),
PARTITION p3 VALUES IN(3),
PARTITION p4 VALUES IN(4),
PARTITION p5 VALUES IN(5),
PARTITION p6 VALUES IN(6),
);
分区用于category
它所在的列tinyint(1)
,每个数字对应一个类别。据我了解,我不能按枚举分区,但我认为这种方式可行吗?
我哪里错了?
编辑
错误如下,
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'PARTITION BY LIST(`category`)( PARTITION p0 VALUES IN(0), PARTITION ' at line 10