I am in the process of creating a website where I need to have the activity for a user (similar to your inbox in stackoverflow) stored in sql. Currently, my teammates and I are arguing over the most effective way to do this; so far, we have come up with two alternate ways to do this:
- Create a new table for each user and have the table name be theirusername_activity. Then when I need to get their activity (posting, being commented on, etc.) I simply get that table and see the rows in it...
- In the end I will have a TON of tables
- Possibly Faster
- Have one huge table called activity, with an extra field for their username; when I want to get their activity I simply get the rows from that table
"...WHERE username=".$loggedInUser
- Less tables, cleaner
- (assuming I index the tables correctly, will this still be slower?)
Any alternate methods would also be appreciated