Reputation: 516
I am storing a large string in each mysql database row that is approximately 1500 characters long. This value is infrequently used, making performance not very important, but the values from the other columns of the database are used frequently.
Is it sub-optimal for me to store these large strings into this table in the same rows as the other data (that I will be accessing more frequently)? Does this hurt performance in some way?
Should I store these large strings in a separate table? I'm just not clear on how mysql optimizes these kind of things, and not sure if I need to worry.
Upvotes: 0
Views: 80
Reputation: 995
There is no need to save these strings in other table if you "dont touch them".
Dont use something like this -
SELECT * FROM `my_table`
this will make you read from database that long string. Try to do it like this.
SELECT field1, field2 FROM `my_table`
where field1 and field2 are not the long string fields. Off course, if you need then include also it in SELECT query. In this way you save time on fetching from database.
And you dont need to worry about this while you dont have a lot of data.
Try reading this:
http://dev.mysql.com/doc/refman/5.0/en/select-optimization.html
Upvotes: 1