user2636197
user2636197

Reputation: 4122

Mysql what type to use when storing 250 character long message

I am storing 250 character long text messages into my mysql DB.

What type should I store it as? Right now I am using text which is (64KB) and that seems to be a little to much of what I need. Or must I use the type (text) of I want to support muliple languishes utf-8 ?

Upvotes: 1

Views: 755

Answers (3)

Tung Nguyen
Tung Nguyen

Reputation: 835

varchar with a suitable length is better than text in your case.

Upvotes: 0

FDavidov
FDavidov

Reputation: 3675

First, a TEXT type is not 64K but goes up to GBs. Second, if your string is 250 chars, why don't you use VARCHAR which can accommodate up to 64K (which is more than enough even if you have UTF-8 encoding?

Upvotes: -1

Florent TESTE
Florent TESTE

Reputation: 21

I think a varchar(255) is enought for your case. Just test it and see if it's good ;)

Upvotes: 2

Related Questions