CREATE TABLE `yy_subscribe2` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`user_id` int(10) unsigned NOT NULL comment '用户id',
`book_id` int(10) unsigned NOT NULL comment '小说id',
`chapter_id` int(10) unsigned NOT NULL comment '章节id',
PRIMARY KEY (`id`),
key book_id(book_id),
key user_id(user_id),
key chapter_id(chapter_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
PARTITION BY RANGE (user_id)
(
PARTITION s0 values LESS THAN (100000),
PARTITION s1 values LESS THAN (200000),
PARTITION s2 values LESS THAN (300000),
PARTITION s3 values LESS THAN (400000),
PARTITION s4 values LESS THAN (500000),
PARTITION s5 values LESS THAN (600000),
PARTITION s6 values LESS THAN (700000),
PARTITION s7 values LESS THAN (800000),
PARTITION s8 values LESS THAN (900000),
PARTITION s9 values LESS THAN (1000000),
PARTITION s10 values LESS THAN (1100000),
PARTITION s11 values LESS THAN (1200000),
PARTITION s12 values LESS THAN (1300000),
PARTITION s13 values LESS THAN (1400000),
PARTITION s999 values LESS THAN MAXVALUE
);
mysql 建立分区报这个错:For RANGE partitions each partition must be defined 。
是什么原因。
另外这是一张小说的章节订阅表。用来记录用户订阅了哪本书的哪一章。目前已有3000W条数据。索引已经做了。打算用分区是否对后续的数据增长有效果?还是不用分区用别的方式?
mysql建分区暂时没玩过,会不会是你语法上有写错,再排查一下;另外 订阅的 这种需求现在好像都推荐用redis这种nosql来玩。