harkly Posted December 30, 2010 Share Posted December 30, 2010 Looking for suggestions on the best way to set up a table in MySQL. I am looking for speed & efficency. I can either set it up 2 ways #1 ID | userID1 | userID2 1 | joe | jane 3 | joe | dylan 4 | jane | joe or #2 userID1 | grant1 | grant2 | grant3 | ... and so on for 25 grants joe | jane | dylan jane | joe What this table is doing is granting rights to another user based on userID1, if the second user is not listed in the table then they are unable to contact userID1. I can see a few issues with both. #1 is going to have the same userID multiple times and will take time to be searched and compared #2 is going to have empty space and be limited in the number of users who can contact userID1 So say there are 1000 different users and they all have granted access to 10 different people, which one would be faster in searching? Or perhaps there is a better way to set it up? I am pretty new to setting up databases so any help would be appreciated! Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/222996-setting-up-a-table/ Share on other sites More sharing options...
trq Posted December 31, 2010 Share Posted December 31, 2010 #1 is by far the better option because of its flexibility. Surely the userID's are numbers though? Quote Link to comment https://forums.phpfreaks.com/topic/222996-setting-up-a-table/#findComment-1153235 Share on other sites More sharing options...
harkly Posted December 31, 2010 Author Share Posted December 31, 2010 No the user id is a varchar. I am worried that #1 may be to slow when there are 1000's of rows. Quote Link to comment https://forums.phpfreaks.com/topic/222996-setting-up-a-table/#findComment-1153370 Share on other sites More sharing options...
Maq Posted December 31, 2010 Share Posted December 31, 2010 No the user id is a varchar. I am worried that #1 may be to slow when there are 1000's of rows. Thousands of rows is nothing... Quote Link to comment https://forums.phpfreaks.com/topic/222996-setting-up-a-table/#findComment-1153408 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.