Mysql分区报错,另外小说订阅表如何优化?

紫川_444868
  • 181
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条数据。索引已经做了。打算用分区是否对后续的数据增长有效果?还是不用分区用别的方式?

回复
阅读 3.1k
1 个回答

mysql建分区暂时没玩过,会不会是你语法上有写错,再排查一下;另外 订阅的 这种需求现在好像都推荐用redis这种nosql来玩。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
宣传栏