什么情况下使用分表分库

来源:11-3 电子书快照表设计

qq_蓝骏毅_04076633

2021-08-17

create table `ebook_snapshot` (
  `id` bigint auto_increment not null comment 'id',
  `ebook_id` bigint not null default 0 comment '电子书id',
  `date` date not null comment '快照日期',
  `view_count` int not null default 0 comment '阅读数',
  `vote_count` int not null default 0 comment '点赞数',
  `view_increase` int not null default 0 comment '阅读增长',
  `vote_increase` int not null default 0 comment '点赞增长',
  primary key (`id`)
) engine=innodb default charset=utf8mb4 comment='电子书快照表';


写回答

1回答

甲蛙

2021-08-19

分库:不同模块的业务可以用分库,比如用户、权限相关的可以放在一个库里。电子书、文档可以放在一个库里。

分表:数据量很大的表可以分表,比如每月一张表。

0
0

Spring Boot+Vue3前后端分离,实战wiki知识库系统

一课掌握前后端最火框架,更有职场竞争力

2524 学习 · 1671 问题

查看课程