在哪种情况下应该使用Neo4j或其他图数据库?

huangapple go评论56阅读模式
英文:

In which case should we use Neo4j or other graph database?

问题

我想制作一个博客网站,我需要一个评论系统(用户可以为每篇文章添加评论)。

考虑以下因素:

  1. 保存大量评论
  2. 我会保存点赞数量
  3. 我需要对这些评论进行排名(评论的分数由点赞数量和时间计算,随着时间的推移会发生变化)

由于将有大量的插入(添加评论)和更新(更新点赞数量)操作,而且我需要根据评论的分数来选择评论,我认为关系型数据库不适用。

Neo4j适合这种情况吗?

我想将每篇文章和评论都保存为Neo4j的节点。

英文:

I want to make a blog website and I need a comment system (user can add comments for each article).

take those into consideration:

  1. save lots of comments
  2. I will save like count
  3. I need to rank those comments (the score of a comment is calculated by like count and time, and will change with time)

As there will be lots of insert(add comments) and update(update like count) operations, and I need to range select comments by score of comment, I think relational database is not suitable.

Is Neo4j suitable for this situation?

I want to save each articale and comment as a node of neo4j

答案1

得分: 1

> 由于将有大量的插入(添加评论)和更新(更新喜欢计数)操作,以及我需要按评论分数范围选择评论,我认为关系数据库不适用。

这很有趣,因为这基本上是关系数据库擅长的事情之一。
话虽如此,这是一个相当简单的任务,任何数据库,无论是关系型还是其他类型的,都应该能够处理,直到评论数量达到了数百万。

> 那么,Neo4J是否适用于这种情况?

如上所述,我相信Neo4J可以处理。但我没有看到任何与图数据库的优势相匹配的内容。您的图仅包含两种类型的节点(articlecomment),每个comment引用了一个article

我个人认为,在平面文件不再足够的情况下,关系型数据库管理系统(RDBMS)是默认选择。所以我会在这里选择RDBMS。但再次强调,您提供的要求应该很容易由任何数据库处理。

英文:

> As there will be lots of insert(add comments) and update(update like count) operations, and i need to range select comments by score of comment, I think relational database is not suitable.

That is interesting, because it is pretty much one of the things a relational database excels at.
That said it is a rather trivial tasks and any database relational or otherwise should be able to handle this until you get into many millions of comments.

> so, is neo4j suitable for this situation?

As said above, I'm sure Neo4J can handle it. But I don't see anything that plays to the strengths of a graph database. You don't have a complex graph. Your graph simply consists of two types of nodes (article and comment) with each comment referencing exactly one article.

I personally consider an RDBMS as the default choice once a flat file isn't sufficient anymore. So I'd pick an RDBMS here as well. But again, the requirements you gave should be easy to handle by any database.

答案2

得分: 1

你所描述的并不太“图形化”。当出现以下情况时,它会更加“图形化”:

  • 想要知道哪些用户在他们评论的事物上相似
  • 拥有一个层次化系统来“标记”帖子和评论
  • 拥有具有任意深度的分层评论
英文:

what you describe is not very "graphy". It becomes more graphy when:

  • you want to know which users are similar with respect to the things they comment on
  • you have a hierarchical system to "tag" posts and comments
  • you have threaded comments with arbitrary depth

huangapple
  • 本文由 发表于 2023年7月13日 17:45:25
  • 转载请务必保留本文链接:https://go.coder-hub.com/76678023.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定