I have user, items and user_items tables, and as usual user has many items. Tables contains: User: ~50K Items: ~3.5M UserItems: ~5M
I am using MySQL and most of my queries are selecting items of a user. So I wonder If it helps to keep data on UserItems table as follows,
user_id item_ids 1 1,22,23,45,66...
Then after getting ids, simply parse to get item ids. Any suggestion/experience?
JOINand relational operations, not string functions. Your 1 record in 125k will be a lot more expensive to check than looking for 40 records in 5m, especially if those 5m rows are all int fields which will take up less space than the equivalent strings. – JNK Jan 18 '12 at 15:40CONCATfunction in MySQL I think (I'm a SQL Server guy myself) that can give you a string of those values. You are confusing data structure and display. How you want to see the data shouldn't affect the structure of the database. – JNK Jan 18 '12 at 15:53