Which MySQL datatype is more space efficient for scalable apps? TEXT or VARCHAR? -


i'm building highly scalable app, , need know data type use small strings (50-1000 chars). heard varchar fixed sized , therefore might faster, text, chars might stored in seperate clob, , pointer in row data. smaller, have significant performance hit?

values in varchar columns variable-length strings. length can specified value 0 255 before mysql 5.0.3, , 0 65,535 in 5.0.3 , later versions.

if have mysql 5.0.3 or later, , don't need more 65k characters, doesn't matter 1 use, because both text , varchar have variable size in storage. if have many texts less 255 characters, can save 1 byte choosing varchar.

but on different aspect, choose data type more appropriate it. if store text, semantically text can exceed "standard" sizes easily, should use text datatype.


Comments

Popular posts from this blog

ruby - When to use an ORM (Sequel, Datamapper, AR, etc.) vs. pure SQL for querying -

php - PHPDoc: @return void necessary? -

c++ - Convert big endian to little endian when reading from a binary file -