简体   繁体   中英

Query data every time or store values in table?

I have a table of players with a field called scores . Players gain different scores at different games. Every few moments, I want to know total score gained by a certain player until then.

Note that I want to do this action frequently.

The question is, which way should I choose?
1) Define a field in my users table as player_score and update it after each game finishes.
2) Every time I want to calculate total score of a player, query on all of the games and sum up the scores gained until now.
Thanks for your help :)

Depends on how much registrers you have on table games. If you have too many records select will take longer.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM