AlwaysCharging wrote: > Thank you for the reply. > > I would, but that's exactly what that article was saying to steer > clear of, and it makes sense. If you have to keep querying the same > table for everyone's new posts and post them back to your "feed" of > the people that you follow, wouldn't that cause serious bottlenecks > and lead to outages? (which is exactly what I think is/was happening > with twitter) > > And right now I'm just at the hypothetical stage as I'm still learning > rails, so I don't have any constraints or requirements of what I'm > trying to do. I was just saying if my app was heavily intensive on > user read/writes so that other users could follow other users, > wouldn't it be best to give each their own table? > > One thing the article made clear was that the design of having a users table makes sense in a *lot* of situations, just not all. The soution they outline is very specific to twitter.
Alto bear this in mind, their system breaks down a little when you decide to follow another user, you then have to find all (all of the historical, just the last day? just the last 100? what?) their posts, and insert them into your private post stream, which could get quite intensive. Granted it doesn't happen as often as searching, or posting, but it could have a big impact. To answer your question though. You would probably have a users table, and that would have a one to many relation to entries in a <username>_stream table. The logic that creates the user in the database would first create the <username>_stream table, and then create the actual user. You would need a fair bit of reflection on the ruby side to get that to work, as their wouldn't be anything in the DB to directly connect the two tables. Which sounds a bit fishy to me. Although I guess you could have <user.id>_stream as the table name, which is a little less ambiguous. Anthony --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---