据我所知,如果将列声明为varchar(15)或varchar(200),则内存大小没有差别。如果你存储一个4个字符的字符串,它应该只使用大约4个字节。这在用于varchar2的Oracle中是相同的。但是,对于Oracle,它们的性能是不同的,因为您设置的大小越大,使用的开销就越多。
它在MySQL (或任何其他数据库)中是相同的吗?
发布于 2012-09-08 00:25:19
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.
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
https://stackoverflow.com/questions/12321885
复制相似问题