- February 26, 2008 1:53 PM
CHAR(M)
ストレージ消費:M文字
最大:255文字
VARCHAR
ストレージ消費:M文字+1または2バイト
最大:65535バイト
実際のVARCHARの最大は、65532バイト。
[test]> create table inno(a varchar(21845)) default character set utf8 engine=innodb;ERROR 1118 (42000): Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. You have to change some columns to TEXT or BLOBs
[test]> create table inno(a varchar(21844)) default character set utf8 engine=innodb;
Query OK, 0 rows affected (0.02 sec)
21844 * 3 = 65532
[test]> create table inno2(a varchar(65533)) default character set latin1 engine=innodb;ERROR 1118 (42000): Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. You have to change some columns to TEXT or BLOBs
[test]> create table inno2(a varchar(65532)) default character set latin1 engine=innodb;
Query OK, 0 rows affected (0.07 sec)
65532+2=65534
残り1バイトは?
ちなみに行の最大は65535バイトという制限がある。
[test]> create table maxrow(a int, b varchar(65529)) default character set latin1 engine=innodb;ERROR 1118 (42000): Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. You have to change some columns to TEXT or BLOBs
[test]> create table maxrow(a int, b varchar(65528)) default character set latin1 engine=innodb;
Query OK, 0 rows affected (0.03 sec)
4+65528=65532