'追随者'和效率 [英] 'Followers' and efficiency

查看:110
本文介绍了'追随者'和效率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在设计一个应用程序,这将涉及用户的追随对方的活动,在Twitter的意义,但我不是非常有经验的数据库/查询设计/效率。是否有最佳实践管理这些,避免陷阱等?我收集这可能会创建一个非常大的负载上的数据库,如果没有正确完成(或者甚至可以?)。

I am designing an app that would involve users 'following' each other's activity, in the twitter sense, but I am not very experienced with database/query design/efficiency. Are there best practices for managing this, pitfalls to avoid, etc.? I gather this can create a very large load on the db if not done properly (or maybe even then?).

如果它有区别, 跟随只有相对较少的人(但一个人可能有很多追随者)。然而这不是一定的,我不想指望它。

If it makes a difference it is likely that people will 'follow' only a relatively small number of people (but a person may have many followers). However this is not certain, and I wouldn't want to count on it.

任何建议感谢。谢谢。

Any advice gratefully received. Thanks.

推荐答案

使用完整的规范化。如果您有一个用户表,每个表都有一个唯一的ID,您将有一个 TABLE_FOLLOWERS 表,其中包含 USERID FOLLOWERID ,它会将每个用户的所有关注者描述为一对多关系。

Pretty simple and easy to do with full normalisation. If you have a table of users, each with a unique ID, you would have a TABLE_FOLLOWERS table with the columns, USERID and FOLLOWERID which would describe all the followers for each user as a one to one to many relationship.

只要你使用一个好的数据库(IE,而不是MS-Access),在一个半正式的数据库服务器上的数百万的assosciations将执行良好和快速。

Even with millions of assosciations on a half decent database server this will perform well and fast as long as you are using a good database (IE, not MS-Access).

这篇关于'追随者'和效率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆