Jump to content

Recommended Posts

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!

 

Link to comment
https://forums.phpfreaks.com/topic/222996-setting-up-a-table/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.