Reputation: 3346
I need a field in my table to store some text. 300 characters is the limit for the text.
What is the best choice the option: varchar (300)
or text
?
Upvotes: 0
Views: 124
Reputation: 234795
VARCHAR and TEXT columns are very similar. The manual says:
In most respects, you can regard a BLOB column as a VARBINARY column that can be as large as you like. Similarly, you can regard a TEXT column as a VARCHAR column.
Here are a few differences:
Upvotes: 1
Reputation: 332541
Use VARCHAR(300)
- if the spec calls for a limit of 300 characters, you don't want to support going over that. I'll have to dig up my answer, but someone reported a substantial improvement by migrating their TEXT
columns to VARCHAR
.
Upvotes: 1
Reputation: 12613
if you have any reason to be concerned with memory, varchar
will only allocate the used memory. I'm not sure how text
does it, but I would use varchar (300)
Upvotes: 1