To preface this question I should say I know very little about database efficiency which will become glaringly apparent very shortly.
This is a fairly simple question:
I'd like to store attendance to events within a mysql database. I've thought of two possible methods (there are more, I'm sure):
- Create an additional
attendancerow in theeventstable, containing a comma separated list of user ids - Create an
attendancetable, containing two columns,event_idanduser_id
My instinct says that method 2 would be the most efficient -- although multiple rows would have to be returned and traversed, this is likely less costly than searching for a particular user_id within a concatinated string...
Can anyone confirm this?