新闻源数据库设计效率

发布于 2024-08-18 01:10:47 字数 804 浏览 2 评论 0原文

大家好,我之前见过类似的问题,但没有结论性或经过测试的答案。

我正在使用 PHP/MySQL 设计一个类似于 facebook 的新闻源系统。由于该表可能会变得相当大——任何低效率都可能导致严重的瓶颈。

通知示例: (粗体项目是链接对象)

User_AUSER_BUser_C的新专辑发表了评论。

用户_A向[他/她的]车库添加了一辆新车辆

最初,我使用 Obj1:Type1 | 的过多列来实现此目的。对象2:类型2 |等等..

它可以工作,但我担心它的可扩展性不够,现在我正在寻找对象序列化。

因此,例如我的新数据库的设置如下:

News_ID  |  User_ID  |                 News_Desc            |   Timestamp

  2643         904     {User904} and {User890} commented on     SomeTimestamp
                       {User222}'s new {Album724}.

{ 中的任何内容都表示将使用 JSON 序列化的数据。

这是一种明智的(高效/可扩展的)前进方式吗?

使用正则表达式将序列化数据与字符串的其余部分分开会很困难吗?

Greetings All, I've seen similar questions asked before with no conclusive or tested answers.

I'm designing a News Feed system using PHP/MySQL similar to facebooks. Seeing as this table could grow to be quite large -- any inefficiency could result in a significant bottleneck.

Example Notifications:
(Items in bold are linked objects)

User_A and USER_B commented on User_C's new album.

User_A added a new Vehicle to [his/her] garage.

Initially, I implemented this using excessive columns for Obj1:Type1 | Obj2:Type2 | etc..

It works but I fear it's not nearly scalable enough, now I'm looking to object serialization.

So, for example my new database is set up like so:

News_ID  |  User_ID  |                 News_Desc            |   Timestamp

  2643         904     {User904} and {User890} commented on     SomeTimestamp
                       {User222}'s new {Album724}.

Anything inside {'s represents data that would be serialized using JSON.

Is this a smart (efficient / scalable) way to move forward?

Will it be difficult to separate the serialized data from the rest of the string using regular expressions?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

北笙凉宸 2024-08-25 01:10:47

如果用户890删除他/她的评论会发生什么?我认为你需要更加原子化 - 可能将操作类型(评论)与操作者(User890)一起存储,然后通过大量缓存动态生成实际故事。如果您将网站扩展到多个市场/受众,这也将有助于解决翻译问题。

What happens if User890 deletes his/her comment? I think you need to be more atomic - possibly storing the type of action (comment) with the actioner (User890), then generate the actual story on the fly, with heavy caching. This would also help the issue of translation, if you extend your site to several markets/audiences.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文