in reply to [OT] Database row width and cargo cult programming
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: [OT] Database row width and cargo cult programming
by moritz (Cardinal) on Apr 06, 2011 at 11:55 UTC | |
by JavaFan (Canon) on Apr 06, 2011 at 13:01 UTC | |
by mpeppler (Vicar) on May 04, 2011 at 13:48 UTC | |
|
Re^2: [OT] Database row width and cargo cult programming
by anonymized user 468275 (Curate) on Apr 06, 2011 at 12:05 UTC |