当前位置:网站首页>mysql 最大建议行数2000w,靠谱吗?
mysql 最大建议行数2000w,靠谱吗?
2022-07-27 18:37:00 【InfoQ】
1 背景
2 实验
CREATE TABLE person( id int NOT NULL AUTO_INCREMENT PRIMARY KEY comment '主键', person_id tinyint not null comment '用户id', person_name VARCHAR(200) comment '用户名称', gmt_create datetime comment '创建时间', gmt_modified datetime comment '修改时间') comment '人员信息表';insert into person values(1,1,'user_1', NOW(), now());select (@i:[email protected]+1) as rownum, person_name from person, (select @i:=100) as init;set @i=1;insert into person(id, person_id, person_name, gmt_create, gmt_modified) select @i:[email protected]+1, left(rand()*10,10) as person_id, concat('user_',@i%2048), date_add(gmt_create,interval + @i*cast(rand()*100 as signed) SECOND), date_add(date_add(gmt_modified,interval [email protected]*cast(rand()*100 as signed) SECOND), interval + cast(rand()*1000000 as signed) SECOND)from person;SET GLOBAL tmp_table_size =512*1024*1024; (512M)SET global innodb_buffer_pool_size= 1*1024*1024*1024 (1G);

3 单表数量限制
CREATE TABLE person( id int(10) NOT NULL AUTO_INCREMENT PRIMARY KEY comment '主键', person_id tinyint not null comment '用户id', person_name VARCHAR(200) comment '用户名称', gmt_create datetime comment '创建时间', gmt_modified datetime comment '修改时间') comment '人员信息表';
4 表空间


5 页的数据结构


6 索引的数据结构


7 单表建议值

- 如果是叶子节点,那么里面就是一行行的数据
- 如果是非叶子节点的话,那么就会继续指向新的页
- 非叶子节点内指向其他页的数量为 x
- 叶子节点内能容纳的数据行数为 y
- B+ 数的层数为 z

8 总结
- Mysql 的表数据是以页的形式存放的,页在磁盘中不一定是连续的。
- 页的空间是16K,并不是所有的空间都是用来存放数据的,会有一些固定的信息,如,页头,页尾,页码,校验码等等。
- 在B+ 树中,叶子节点和非叶子节点的数据结构是一样的,区别在于,叶子节点存放的是实际的行数据,而非叶子节点存放的是主键和页号。
- 索引结构不会影响单表最大行数,2kw也只是推荐值,超过了这个值可能会导致B+树层级更高,影响查询性能。
9 参考
- https://www.jianshu.com/p/cf5d381ef637
- https://www.modb.pro/db/139052
- 《MYSQL内核:INNODB存储引擎 卷1》
边栏推荐
- Knowledge management system promotes the development of enterprise informatization
- Obtain website shell permission based on file upload vulnerability
- SQL coding bug
- sscanf 导致地址越界
- Tips for file upload to bypass WAF
- 论文赏析[AAAI18]面向序列建模的元多任务学习
- 如何对话CIO/CTO
- Remember that resttemplate.getforentity failed to carry headers once, resttemplate exchange
- Typoa spelling check: missing dictionary file for Chinese
- Natapp intranet penetration tool Internet access personal projects
猜你喜欢

MapGIS三维场景渲染技术与应用

Win11系统更新KB5014668后点开始按钮没反应怎么办?

js闭包知识

Leetcode daily practice - the penultimate node in the linked list

Automated testing ----- selenium (II)

Hexagon_V65_Programmers_Reference_Manual(6)

智能网联跑出中国「加速度」,26.15%搭载率背后的市场洗牌
![[today in history] July 27: model testing pioneer was born; Microsoft acquires qdos; The first laser typesetting Chinese newspaper](/img/d5/815c5089c12a776c7edbd42dc7d483.png)
[today in history] July 27: model testing pioneer was born; Microsoft acquires qdos; The first laser typesetting Chinese newspaper

Leetcode daily practice 206. Reverse the linked list

中地数码:融合创新国产GIS 乘风而上助推实景三维中国建设
随机推荐
怎样实现文档协同?
Second uncle, why is it so hot?
人脸识别5.1- insightface人脸检测模型训练实战笔记
LeetCode每日一练 —— 21. 合并两个有序链表
Differences among native objects, built-in objects, and host objects
Ue5 uses DLSS (super sampling) to improve the FPS of the scene away from the optimization scheme of Caton
最新版web漏洞扫描工具AppScan\AWVS\Xray安装及使用教程
R language uses LROC function of epidisplay package to visualize ROC curve of logistic regression model and output diagnostic table, visualize multiple ROC curves, and use legend function to add legen
NPDP|什么样的产品经理可以被称为优秀?
"Harvest" NFT: 200 yuan to buy pictures on Taobao, and 300000 yuan on the chain
User login switching case
API gateway introduction
JS closure knowledge
[today in history] July 27: model testing pioneer was born; Microsoft acquires qdos; The first laser typesetting Chinese newspaper
用伪元素before实现元素的等比例缩放
云管平台中租户以及多租户概念简单说明
重复的DNA序列[hash判定重复+滑动窗口+二进制编码之位运算]
Automated testing ----- selenium (II)
Diffuse reflection of QT OpenGL light
MAPGIS 3D pipeline modeling awakens the pulse of urban underground pipelines