Reputation: 926
I'm getting a syntax error when trying to subpartition a table in MySQL. There's no error when trying to use either of the methods for a regular partition, just with subpartitioning. It's the last 2 lines that cause the error and I'm a bit lost.
I've also tried switching around KEY to HASH, and LIST to RANGE for the main partition, but still throws the error.
CREATE TABLE `map_polygon` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`district_id` int(10) unsigned NOT NULL DEFAULT '0',
`map_type_id` int(10) unsigned DEFAULT NULL,
`is_big_data` tinyint(1) DEFAULT '0',
`polygon_group` int(10) unsigned DEFAULT NULL,
`name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`sort_order` int(10) unsigned DEFAULT NULL,
`locations` mediumtext COLLATE utf8_unicode_ci,
`north` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`south` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`east` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`west` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`group_north` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`group_south` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`group_east` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`group_west` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`deleted_by_user_id` int(10) unsigned DEFAULT NULL,
`created_by_user_id` int(10) unsigned NOT NULL,
PRIMARY KEY (`id`,`district_id`, `is_big_data`),
KEY `map_polygons_created_by_user_id_foreign` (`created_by_user_id`),
KEY `map_polygons_deleted_by_user_id_foreign` (`deleted_by_user_id`),
KEY `map_polygons_map_type_id_foreign` (`map_type_id`),
KEY `map_polygons_district_id_foreign` (`district_id`),
KEY `is_big_data` (`is_big_data`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
PARTITION BY LIST(is_big_data)
PARTITIONS 2 (
PARTITION pNormal VALUES IN (0),
PARTITION pBigData VALUES IN (1)
)
SUBPARTITION BY KEY(district_id)
SUBPARTITIONS 10;
Upvotes: 0
Views: 78
Reputation: 27294
Just a slight rearrangement of the partition clause it seems (http://www.sqlfiddle.com/#!9/9d746)
PARTITION BY LIST(is_big_data)
SUBPARTITION BY KEY(district_id)
SUBPARTITIONS 10
(
PARTITION pNormal VALUES IN (0),
PARTITION pBigData VALUES IN (1)
);
Upvotes: 1