Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

varchar vs. mediumtext

I have a website that has approx 1000 different strings in a mysql database which are used to display all of the text on my website. The reason the string are stored in a database is because I'm supporting 2 different languages and need to be able to display the different languages based on the users preference (english and chinese)

The strings vary in length and probably 250 of them would be too long to fit inside at varchar.

I am about to implement this database but I am unsure about whether to build one table with varchars which will fit 750 strings, and then use another table using mediumtext to store the remaining 250 longer strings.

Is the performance difference between varchar and mediumtext great enough to warrant the extra trouble in setting up 2 tables? Or would you recommend just using 1 table with everything using mediumtext.

Users will not be able to search this data and I'm using PHP to display the data.

Thanks

like image 964
justinl Avatar asked Oct 15 '22 15:10

justinl


1 Answers

I would suggest using mediumtext rather than splitting your data into two tables. The performance difference between varchar and mediumtext great enough to warrant you to split 1000 records into two tables.

A properly indexed tables should do the job well enough.

like image 194
Steve Obbayi Avatar answered Oct 18 '22 14:10

Steve Obbayi