physaux Posted November 6, 2009 Share Posted November 6, 2009 Hey guys, lets say I have about 2500 users, Each User can have say up to 100 "private messages" stored at a time. What is the best way to put this into a table? A-make a table for each user with a messageID or B- make a table for messages, and just link them to each member Which way would be better? A- would make LOTS of tables B- each query would access LOTS more messages than it needs to, and have to search through all of it for each user. Or is there a better choice C? Thanks! Link to comment https://forums.phpfreaks.com/topic/180587-solved-mysql-table-question-which-way-is-more-logical-efficient/ Share on other sites More sharing options...
JAY6390 Posted November 6, 2009 Share Posted November 6, 2009 Make a single table, with the following sender_id receiver_id title message timestamp? creating tables will get ridiculous for it Link to comment https://forums.phpfreaks.com/topic/180587-solved-mysql-table-question-which-way-is-more-logical-efficient/#findComment-952753 Share on other sites More sharing options...
physaux Posted November 6, 2009 Author Share Posted November 6, 2009 Hmm I see. no offense, I just want a couple more people's opinions before i put it to "solved", but thanks! Link to comment https://forums.phpfreaks.com/topic/180587-solved-mysql-table-question-which-way-is-more-logical-efficient/#findComment-952755 Share on other sites More sharing options...
JAY6390 Posted November 6, 2009 Share Posted November 6, 2009 No problem and none taken I doubt anyone else would agree with creating individual tables for it though Link to comment https://forums.phpfreaks.com/topic/180587-solved-mysql-table-question-which-way-is-more-logical-efficient/#findComment-952757 Share on other sites More sharing options...
lemmin Posted November 6, 2009 Share Posted November 6, 2009 Definitely use two tables; one for users and one for messages (like JAY6390 said). Just relate the sender_id and receiver_ids to the user ids. Link to comment https://forums.phpfreaks.com/topic/180587-solved-mysql-table-question-which-way-is-more-logical-efficient/#findComment-952758 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.