当前位置:网站首页>MySQL innodb每行数据长度的限制
MySQL innodb每行数据长度的限制
2022-06-29 09:26:00 【一缕阳光a】
今天在使用MySQL innodb时,create table时,报出这样的一个错误:
Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. You have to change some columns to TEXT or BLOBs
查阅MySQL的官方资料才发现,每条记录有最大长度的。MySQL的官方文档:
链接:https://dev.mysql.com/doc/refman/8.0/en/column-count-limit.html#row-size-limits

在MySQL innodb中,所有的数据都是按页(page)来操作的,一页就是16KB(默认的),采用B+树作为索引,B+树中每个节点都是16KB,在最底层的每个叶子节点中存储数据,以主键索引为例,如果每个叶子节点为16KB,那么一行数据超过16KB时,就会出现行溢出,溢出的数据放到另一个page中,即uncompresse blob page
但是在B+树中,每个叶子节点page中至少存储2行数据,否则就失去了意义。那么一行数据的长度就是小于8KB,在一行数据长度超过8KB时,innodb将会将剩余的部分数据写出到另一个溢出页中,该列的前768字节存放在该页中,同时有个偏移指向溢出页。
官方给出的解决方式:
1.垂直表字段拆分或者大字段合并(大字段最多不超过768,业务进行合并+拆分)
2.修改表的存储引擎,modify InnoDB to MyISAM.
3.修改row_format为COMPRESSED或者DYNAMIC,当然前提需保证innodb_file_format =Barracuda.
边栏推荐
- Recyclerview sticky (suspended) head
- HDU 6778 car (group enumeration -- > shape pressure DP)
- RecyclerView 通用适配器封装
- 十六制计数器和流水灯
- To 3 --- 最后的编程挑战
- 使用Rancher搭建Kubernetes集群
- QGIS mapping
- GridView of basic component of shutter
- Application of keil5 integrated development environment for single chip microcomputer
- Slide the custom control to close the activity control
猜你喜欢
随机推荐
2019-11-10 training summary
Power strings [KMP cycle section]
Six dimensional space BFS
Signal works: time varying and time invariant
使用Rancher搭建Kubernetes集群
图片验证码控件
2019icpc上海区域赛赛后总结
L2-026 small generation (25 points)
Codeforces Round #657 Div. 2
Gmail: how to quickly read all messages
Rikka with Cake(线段树+线段树)
Recyclerview universal adapter package
520 钻石争霸赛 2021
Acwing271 [teacher Yang's photographic arrangement] [linear DP]
2019.10.20训练总结
L2-3 这是二叉搜索树吗?-题解超精彩哦
Rikka with cake (segment tree + segment tree)
If I were in Beijing, where would it be better to open an account? In addition, is it safe to open an account online now?
Image of the basic component of the shutter
Arc view and arc viewpager









