简体   繁体   English

每次查询数据还是将值存储在表中?

[英]Query data every time or store values in table?

I have a table of players with a field called scores . 我有一张players表,其中有一个名为“ 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. 1)在我的用户表player_score一个字段定义为player_score ,并在每个游戏结束后player_score进行更新。
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. 2)每当我想计算一个球员的总得分时,请查询所有游戏并总结到目前为止获得的得分。
Thanks for your help :) 谢谢你的帮助 :)

Depends on how much registrers you have on table games. 取决于您在桌上游戏中拥有多少注册者。 If you have too many records select will take longer. 如果记录太多,则选择将花费更长的时间。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 SQLite-每次查询数据还是将值存储在表中? - SQLite - Query data every time or store values in table? 查询每次运行都会返回相同的数据 - Query returns same data every time it runs 将数据存储在一个大表中或每月创建一个新表 - store data in one large table or create new table every month 查询 hive 表中时间序列数据的前一个时间点不可用的新值 - query for finding new values not available in the previous time point for time series data in hive table 每24小时安排一次MySQL查询; 查询表并将结果存储在另一个表中 - Schedule MySQL query every 24 hours; query table and store results in another table 每次与查询一起覆盖值以查看值是否已更改 - Overwrite values every time vs query to see if value has changed 如果与表值匹配,则在每次插入中查找的表中包括数据 - Include data in a table looking in every insert if there is a match with the table values 查询表中每个可能的日期组合并求和值 - Query every possible date combination in a table and sum values SQL Sum函数在每次运行查询时给出不同的数据 - Sql Sum function giving different data every time running query 如何查询将日期时间值存储为 biginit 的数据库表 - How to query a database table which store the datetime values as biginit
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM