views:

940

answers:

2

Hello,

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

+4  A: 

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.

Steve Obbayi
Thanks Sobbayi. That's what I needed to hear to make the decision. I thought keeping it 1 table would be the better route but I wanted to hear from people more experienced than me regarding the pros and cons of the performance on the different datatypes. Thanks again!
justinl
A: 

As a 3rd option, could you have them in small HTML files which could be included in based on when you need them?

kevchadders
The website dynamically generates most of it's content so unfortunately that approach (while being simpler) wouldn't work.
justinl