Alix Axel
Alix Axel

Reputation: 154513

MySQL - TEXT vs CHAR and VARCHAR

Reading this question, a doubt popped into my head:

So how much bytes does TEXT actually occupy? ~65KB or number of chars used + 1?

Upvotes: 34

Views: 47198

Answers (2)

Pindatjuh
Pindatjuh

Reputation: 10526

TEXT is a variable length datatype, with a maximum of 65,000 characters.

LONGTEXT can be used for over 4 trillion characters.

To answer your question: it's a variable lenght, and it will only occupy the amount of characters you store.

Upvotes: 30

Aleksandr
Aleksandr

Reputation: 91

TEXT occupies a number actual length of your data + 2 bytes.

Upvotes: 9

Related Questions