首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >MySql可变字符类型性能

MySql可变字符类型性能
EN

Stack Overflow用户
提问于 2012-09-08 00:18:55
回答 1查看 112关注 0票数 0

据我所知,如果将列声明为varchar(15)varchar(200),则内存大小没有差别。如果你存储一个4个字符的字符串,它应该只使用大约4个字节。这在用于varchar2的Oracle中是相同的。但是,对于Oracle,它们的性能是不同的,因为您设置的大小越大,使用的开销就越多。

它在MySQL (或任何其他数据库)中是相同的吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-09-08 00:25:19

  • VARCHAR:

代码语言:javascript
复制
1. Stores strings of variable length. 
2. The length parameter specifies the maximum length of the strings 
3. It stores up to 2000 bytes of characters
4. It will occupy space for NULL values 
5. The total length for strings is defined when database was created. 

  • VARCHAR2:

代码语言:javascript
复制
1. Stores strings of variable length. 
2. The length parameter specifies the maximum length of the strings 
3. It stores up to 4000 bytes of characters
4. It will not occupy space for NULL values 
5. The total length of strings is defined when strings are given

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12321885

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档