After all, when a VARCHAR allows arbitrary Unicode characters, the maximal byte width is four times the character count (for UTF-8, UTF-16 and UTF-32), so a character length of 255 won't lead to a byte length that fits into a byte.You got it backwards. ;-) When storing UTF-8 characters in a VARCHAR(255), you may not be able to store 255 characters.
The size is the byte length. And 255 takes a single byte to store the length, anything above takes 2 bytes.
Also note that many (var)char columns will not be used to store non-ASCII data. Just because Unicode exists doesn't mean everything requires non-ASCII (or non-LATIN-1) characters.
In reply to Re: [OT] Database row width and cargo cult programming
by JavaFan
in thread [OT] Database row width and cargo cult programming
by moritz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |