in reply to [untitled node, ID 280779]
dragonchild gave you the right answer from the perspective of having a normalized schema, but didn't discuss performance.
If you have a Group table, indexed by group ID, and a linking table indexed by user ID + group ID, the JOIN you need to get from a user ID to a list of group names will scale fairly well. Because you have indexes, you're not scanning entire tables. Because of the composite index on the linking table, MySQL can do a partial key lookup (which avoids scanning the entire table), and can pull the group ID out of the index. From there, the lookup of the corresponding Group record is done using an index.
If you're skeptical, as you should be if you're concerned about scalability, prototype this scheme and benchmark it.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: MySQL / Perl theory & design conundrum
by shemp (Deacon) on Aug 04, 2003 at 21:47 UTC |