enchance
enchance

Reputation: 30411

Is VARCHAR(900) ok or should I go for TEXT in MySQL?

I don't want to use TEXT if possible because of the extra overhead. Is it ok to have a VARCHAR(900) or some other high number in the ()?

Upvotes: 0

Views: 476

Answers (3)

NoviceProgrammer
NoviceProgrammer

Reputation: 3365

A TEXT or BLOB columns are just pointed to on disk by an address in the row. Therefore the table can't be stored in memory.

This would mean that every time you select that column you will have to access the file system which will be slower. A recommendation that i have often seen is to then keep the text column as a separate table.

But a limit of 900 should be ok to keep as varchar.

Upvotes: 1

Sonal Khunt
Sonal Khunt

Reputation: 1894

its ok no problem using varchar(900) if you limited to store 900 character than no problem

Upvotes: 0

Udo Held
Udo Held

Reputation: 12538

If you are sure you won't exceed the limits for your column in future its fine.

http://dev.mysql.com/doc/refman/5.6/en/char.html

You row however shouldn't exceed the maximum row size fo 65535 bytes. This limit applies to all your columns in that table.

Upvotes: 1

Related Questions