什么是好的排名系统设计
我有一个 USER 表,其中包含 userId 和 point 字段。在运行时,我想知道特定用户根据其观点的排名。实现这一目标的最佳方法是什么:
1:查询所有用户到列表中。根据点对列表进行排序,并进行二分搜索以查找该用户的排名。听起来这是个坏主意。
2:是否可以通过创建数据库查询来完成这些任务?
我预计有 2000-5000 个用户。
I have a USER
table, that has userId
and point
fields. At runtime, I want to know what is a ranking of a particular user base on their point. What is the best way to accomplish this:
1: Query all users into a list. Sort the list base on point and do a binary search to find the ranking of that user. Sound like a bad idea here.
2: Is it possible to accomplish these tasks by creating database queries?
I expect 2000-5000 users.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)