Achievements / Badges system

后端 未结 4 811
情歌与酒
情歌与酒 2021-01-29 19:29

I have been browsing this site for the answer but I\'m still a little unsure how to plan a similar system in its database structure and implementation.

In PHP and MySQL

4条回答
  •  耶瑟儿~
    2021-01-29 20:14

    regarding the sketch you included: get rid of the boolean column on badges_user. it makes no sense there: that relation is defined in terms of the predicate "user user_id earned the badge bd_id at assigned_at".

    as for your overall question: define the schema to be relational without regard for speed first (that'll get you rid of half of potential perf. problems, possibly in exchange for different perf. problems), index it properly (what's proper depends on the query patterns), then if it's slow, derive a (still relational) design from that that's faster. like you may need to have some aggregates precomputed, etc.

提交回复
热议问题