project - Handle a Timeline (MySQL) -
i'm on pseudo-social app.
have 3 tables:
users: _id_, username, password, email movies: _id_, title, synopsis followers: __(#user_id1, #user_id2)__, timestamp u_movies: __(#user_id, #movie_id)__, rating, timestamp
we want add timeline our app, simple timeline, recent activities. don't want custom timeline (no messages), activities.
what best way "create" timeline ?
be, creating "timeline" table activities written (doing insert timeline
when there insert followers
, u_movies
?), or getting mysql , join on
latest followers activities (with timestamp, think heavy if there many many entries , users), , advice ?
thank !
i've done similar thing recently. first idea best, add data new table (either trigger or insert)
presuming not doing , updates or deletes on table should scale quite well. partition table in mysql based on date range. keep performance going after few years (my first version of has 140million rows on 4 years , still quick)
edit - detecting changes.
using trigger route - before update allow compare columns , perform insert timeline give historical changes.
create trigger upd_check before update on account each row begin if new.rating != old.rating insert timeline .. end if; end;
Comments
Post a Comment