0

i was gonna build activity system based on one of the user post from How to implement the activity stream in a social network and i was wondering if should i put reply comments on separate table or should i keep it in same table. btw reply is same as replying to any activity on facebook and it shows right under it. so i think if i keep it separate, then the query will load slow, no?

Community
  • 1
  • 1
Basit
  • 16,316
  • 31
  • 93
  • 154
  • never think about performance when designing databases. this will be rarely ever a problem. databases are optimized for that stuff. if a performance problem appears there are other ways then crippling the db design to fix it. – Christian Feb 03 '11 at 05:38

1 Answers1

0

i think comments should go into a separate table. there might be multiple comments for one activity so you need a 1<->* relation with this comment table. if you use the same table for activities and comments it must be possible to attach a parent to this table. parent = activity, children = comments.

Christian
  • 3,551
  • 1
  • 28
  • 24
  • well on activity streaming you cant really do database normalization. if you look at the examples on the link i posted. they cut of the relationship between tables, because of performance issue, so have to keep in mind about the performance, cause this is second time im actually building feeds, so need to get it done right this time – Basit Feb 03 '11 at 05:41
  • build it as easy and logic as possible. build it also modular. when you have actual data or proper testsets you see if it works well enough. if not you can still replace that part or add a cache, memory index or whatever. if your design is optimized for speed from the beginning it will be much harder to change. – Christian Feb 03 '11 at 05:51