当前位置:网站首页>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》
边栏推荐
- Hexagon_ V65_ Programmers_ Reference_ Manual(8)
- 论文赏析[EMNLP18]针对自顶向下和中序移进归约成分句法分析的Dynamic Oracles
- "Harvest" NFT: 200 yuan to buy pictures on Taobao, and 300000 yuan on the chain
- Installation and use tutorial of the latest version of Web vulnerability scanning tool appscan\awvs\xray
- How to solve the problem when the Microsoft account login of the computer keeps turning around
- Leetcode daily practice 206. Reverse the linked list
- Custom learning rate
- Codeforces 1706E 并查集 + 启发式合并 + ST 表
- Chapter 7 Intermediate Shell Tool I
- Leetcode daily practice - 876. Intermediate node of linked list
猜你喜欢

Do you know about data synchronization?

Typoa spelling check: missing dictionary file for Chinese

JS closure knowledge

LeetCode每日一练 —— 203. 移除链表元素

NPDP|什么样的产品经理可以被称为优秀?

数字引领 规划先行 聚焦智慧规划信息平台建设及应用项目探索实践

PHP code audit 5 - XSS vulnerability
![Repeated DNA sequence [hash determination repetition + sliding window + bit operation of binary coding]](/img/ed/6f4da22e86b44935fc84e3b4901c48.png)
Repeated DNA sequence [hash determination repetition + sliding window + bit operation of binary coding]

LeetCode每日一练 —— 21. 合并两个有序链表

Installation and use tutorial of the latest version of Web vulnerability scanning tool appscan\awvs\xray
随机推荐
Leetcode daily practice - cm11 linked list segmentation
Obtain website shell permission based on file upload vulnerability
基于文件上传漏洞获得网站 shell 权限
用伪元素before实现元素的等比例缩放
Vant component library
Chapter 7 Intermediate Shell Tool I
Leetcode-209- subarray with the smallest length
Typoa spelling check: missing dictionary file for Chinese
Set up discuz forum and break the stolen database
R language uses dplyr package to connect two dataframe data (left join)
一文读懂Plato Farm的ePLATO,以及其高溢价缘由
Digital leading planning first, focusing on the construction of intelligent planning information platform and the exploration and practice of application projects
Feixin died in 2022: a good hand of China Mobile was broken, and 500million users became "zombies"
Ue5 uses DLSS (super sampling) to improve the FPS of the scene away from the optimization scheme of Caton
Knowledge management system promotes the development of enterprise informatization
Leetcode daily practice 206. Reverse the linked list
Win11 user name and password backup method
14 day Hongmeng device development practice - Chapter 7 device networking cloud learning notes
Opencv implements image clipping and scaling
How to talk to CIO / CTO