MySQL - 行大小如何高于65535(MySQL - How is the row size above 65535)
据我所知,mysql中的最大行限为65535,等于(2 ^ 16) - 1 。 我也明白,拥有这么长的行是不好的数据库设计。 但是,这是我的架构
CREATE TABLE mytable(
a VARCHAR(20000),
b VARCHAR(20000),
c VARCHAR(20000),
d VARCHAR(5535)
) CHARACTER SET=latin1;
这是我得到的输出
行大小太大。 使用的表类型的最大行大小(不包括BLOB)是65535 。 这包括存储开销,请查看手册。 您必须将某些列更改为TEXT或BLOB
我们再来做一遍
20000 + 20000 + 20000 + 5535 = 65535
等于并且不超过限制。 对于记录,有效的列d的最高值是5526 。
我不明白这些额外的9个字符来自哪里。
I understand that the maximum row limit in mysql is 65535, which is equal to (2 ^ 16) - 1. I also understand that it is bad database design to have extremely long rows like that. However, this is my schema
CREATE TABLE mytable(
a VARCHAR(20000),
b VARCHAR(20000),
c VARCHAR(20000),
d VARCHAR(5535)