Mysql - Mysql datatype varchar vs mediumtext, Which data type is better to use

Mysql datatype varchar vs mediumtext

Answering this question is difficult, some one thinks its silly question and even this might not be considered as a question by few developers. But actually for developers in beginning stage, it might be difficult to make decision which data type has to be selected. To be honest even I cant answer this question because it depends on the requirement. The below values might make you to decide which datatype has to be used for storing text or strings. I wore this blog because I had confusion to choose TEXT or VARCHAR, VARCHAR or MEDIUMTEXT, TEXT or MEDIUMTEXT, MEDIUMTEXT or LONGTEXT. Still its a big question to answer. But you have to decide it based on your requirement.


Maximum TEXT length
The maximum size of a TEXT data type depends on which type of TEXT data type is being used. Because they are stored as objects, the only row overhead in the table object is a pointer (8 or 16 bytes). Here is a list of the maximum TEXT length, and the overhead (in the TEXT object):

VARCHAR - up to 65,532 bytes.

TINYTEXT - up to 255 bytes, 1 byte overhead

TEXT - up to 64 Kb, 2 bytes overhead

MEDIUMTEXT - up to 16 Mb, 3 bytes overhead

LONGTEXT - up to 4 Gb, 4 bytes overhead 

The topic on Mysql - Mysql datatype varchar vs mediumtext is posted by - Math

Hope you have enjoyed, Mysql - Mysql datatype varchar vs mediumtextThanks for your time

Tech Bluff