[英]Best approach to user activity wall
I have different post types, like status updates, projects, donation etc. Each type of post has its one or more tables in databse. 我有不同的帖子类型,例如状态更新,项目,捐赠等。每种类型的帖子在数据库中都有其一个或多个表格。 A user can create all post types. 用户可以创建所有帖子类型。 User has a wall like Facebook where he can see different post types which he created in chronological order (any post type created last should be on top of the wall). 用户有一个像Facebook这样的墙,他可以按时间顺序查看他创建的不同帖子类型(最后创建的任何帖子类型都应在墙上)。
What would be the most appropriate approach? 什么是最合适的方法?
simple to set up, doesn't perform very well (has a very bad worst-case). 设置简单,效果不佳(最坏的情况是非常糟糕的)。
is the simplest. 是最简单的。 You say complex but you can do this fairly easy with a UNION + ORDER BY
construction. 您说的很复杂,但是您可以使用UNION + ORDER BY
构造相当容易地做到这一点。 Performance will be pretty good. 性能会很好。
will perform the best I think but there will be some duplication and things might get a little complex. 我会认为效果最好,但是会有些重复,情况可能会变得有些复杂。 Relational databases are not very good at polymorphism. 关系数据库不是很擅长多态。
What's important to realize is that it's relatively easy to switch between these solutions. 重要的是要意识到在这些解决方案之间进行切换相对容易。 If you have a service oriented architecture (or just good design in general). 如果您具有面向服务的体系结构(或者总体而言只是好的设计)。 So I wouldn't be too worried about which approach you pick. 因此,我不会太担心您选择哪种方法。 If in the future it seems your chosen approach doesn't work too well you could switch to another. 如果将来您选择的方法似乎效果不佳,则可以改用其他方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.