I have read different explanations of varchar
and so far I've gotten this:
CHAR( ) fixed from 0 to 255 characters long
VARCHAR( ) variable from 0 to 255 characters long
TINYTEXT maximum length of 255 characters
TEXT maximum length of 65535 characters
BLOB maximum length of 65535 characters
MEDIUMTEXT maximum length of 16777215 characters
MEDIUMBLOB maximum length of 16777215 characters
LONGTEXT maximum length of 4294967295 characters
LONGBLOB maximum length of 4294967295 characters
and then this
char(n) variables store fixed-length character strings conisisting of exactly n characters (and, therefore, n bytes). They are limited to 8,000 characters in size.
nchar(n) variables store fixed-length Unicode character strings conisisting of exactly n characters (and, therefore, 2*n bytes). They are limited to 4,000 characters in size.
varchar(n) variables store non-fixed length character strings consisting of approximately n characters. They consume l+2 bytes of space, where l is the actual length of the string. They are limited to 8,000 characters in size.
So really what is the character max on varchar
? Reason I am wondering is I am starting a simple little CMS
and I don't want my SQL DB to overloaded with weight and as you can see for example
nvarchar(max)[length] * 2 + 2
nvarchar being 100,000 * 2 + 2 = 200,002 bytes (what is + 2 is it literal?)
Also I've read that varchar(8,000)
is better than varchar(max)
so what would you suggest the type that I use for a variably changing character length, especially for content.
http://dev.mysql.com/doc/refman/5.0/en/char.html
The length can be specified as a value from 0 to 255 before MySQL 5.0.3,
and 0 to 65,535 in 5.0.3 and later versions.
I don't think your second paste is talking about MySQL.