Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Post History
The reference indicated by jcsahnwaldt indeed specifies the space required by VARCHAR columns, namely (L = string length): L + 1 bytes if column values require 0 − 255 bytes, L + 2 bytes if valu...
Answer
#2: Post edited
- [The reference](https://dev.mysql.com/doc/refman/8.0/en/storage-requirements.html#data-types-storage-reqs-strings) indicated by jcsahnwaldt indeed specifies the space required by VARCHAR columns, namely (L = string length):
- > L + 1 bytes if column values require 0 − 255 bytes, L + 2 bytes if values may require more than 255 bytes
However, I think this is true only for non-Unicode characters and expect to have more depending on collation. This [rather old answer](https://stackoverflow.com/a/1790570/2780791) from Stack Overflow suggests that a character might take up 1-3 bytes depending on the actual character / collation.
- [The reference](https://dev.mysql.com/doc/refman/8.0/en/storage-requirements.html#data-types-storage-reqs-strings) indicated by jcsahnwaldt indeed specifies the space required by VARCHAR columns, namely (L = string length):
- > L + 1 bytes if column values require 0 − 255 bytes, L + 2 bytes if values may require more than 255 bytes
- However, I think this is true only for non-Unicode characters and expect to have more depending on collation. This [rather old answer](https://stackoverflow.com/a/1790570/2780791) from Stack Overflow suggests that a character might take up 1-4 bytes depending on the actual character / collation.
#1: Initial revision
[The reference](https://dev.mysql.com/doc/refman/8.0/en/storage-requirements.html#data-types-storage-reqs-strings) indicated by jcsahnwaldt indeed specifies the space required by VARCHAR columns, namely (L = string length): > L + 1 bytes if column values require 0 − 255 bytes, L + 2 bytes if values may require more than 255 bytes However, I think this is true only for non-Unicode characters and expect to have more depending on collation. This [rather old answer](https://stackoverflow.com/a/1790570/2780791) from Stack Overflow suggests that a character might take up 1-3 bytes depending on the actual character / collation.