MySQL: why varchar(254) and not varchar(255)? MySQL: why varchar(254) and not varchar(255)? database database

MySQL: why varchar(254) and not varchar(255)?


Your Google query gave you the hints already. One of the first hits is this:

https://www.vbulletin.com/forum/project.php?issueid=32655

It basically says, that FULLTEXT indexes on VARCHAR(255) require twice the space of a VARCHAR(254) FULLTEXT index. And some more other bloat on top of that.

I think this is far more important than saving one byte in the data table.


varchar fields require n+1 bytes for fields less than or equal to 255and required n+2 bytes for fields > 255

http://dev.mysql.com/doc/refman/5.0/en/storage-requirements.html

It should be set to 255, I'm assuming developers think they will save an extra byte from 254, but 255 is the standard