免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2394 | 回复: 2
打印 上一主题 下一主题

关于数据类型 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2011-07-18 15:57 |只看该作者 |倒序浏览
本帖最后由 txwdhs 于 2011-07-18 16:55 编辑

今天修改一个varchar(20000)的字段为varchar(60000),发现数据类型自动变为了mediumtext,请问mediumtext和varchar有什么区别么?我这样修改了会不会有错?
因为之前varchar(20000)满足不了业务需求,所以需要增加长度

论坛徽章:
0
2 [报告]
发表于 2011-07-21 09:42 |只看该作者
请问大家没有对这个有了解的么

论坛徽章:
0
3 [报告]
发表于 2011-07-21 10:00 |只看该作者
Every table (regardless of storage engine) has a maximum row size of 65,535 bytes. Storage engines may place additional constraints on this limit, reducing the effective maximum row size.

The maximum row size constrains the number (and possibly size) of columns because the total length of all columns cannot exceed this size. For example, utf8 characters require up to three bytes per character, so for a CHAR(255) CHARACTER SET utf8 column, the server must allocate 255 × 3 = 765 bytes per value. Consequently, a table cannot contain more than 65,535 / 765 = 85 such columns.

Storage for variable-length columns includes length bytes, which are assessed against the row size. For example, a VARCHAR(255) CHARACTER SET utf8 column takes two bytes to store the length of the value, so each value can take up to 767 bytes.

BLOB and TEXT columns count from one to four plus eight bytes each toward the row-size limit because their contents are stored separately from the rest of the row.

超过行的长度了,TEXT是另外在别的地方存储的,不会占用行长度。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP