I have a content management system in which a user can dynamically create an html form. I have all the tables setup for that. But there's one thing that troubles me and that is, the text size for the entered values.
Some forms have textareas and some textareas contain quite an amount of data. But there are also just simple textfields on the form, which contain just a few characters of data.
My database table for saving the values kind of looks like this:
form_values
id | form_id | fk_element_id | value
So in this case the value
column will hold the entered data for a specific field type. So in the case of a textfield this will only be a few characters. But in the case of a textarea, this can be alot of data.
That means the value
column must be at least of type TEXT
. Eventhough most types will not exceed 255 characters (MAX VARCHAR)
.
Now i'm not sure if this is the right approach. Will this give a performance penalty when i query the table? Do i have to save the textarea data in another table..? Or something like that?
Or can i simply change the value
column to a TEXT
type without any problems..?
VARCHAR maximum length is 255 prior to MySQL 5.0.3 , from MySQL 5.0.3 onwards the maximum length is 65535 , which is the maximun row size, so that maximum value is shared among all fields in the row.