Neo4j如何处理大型数据库?

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

How does Neo4j work with large databases?

问题

Neo4j 如何处理大型数据库(>50GB)?由于数据库太大,无法完全加载到主内存中。那么 Neo4j 是如何处理这样的数据库的?是否有一种分页机制?如果有,它是如何工作的?如果没有,它是如何将数据库的部分加载到内存中的?我想了解其底层工作原理。

英文:

Imagine there is a large database (>50GB) and because of its size it cannot be loaded entirely in the main memory. So how does Neo4j work with such databases? Is there some kind of paging? If so how does it work, if not - how does it load parts of the database in memory? I want to understand how it works at a low level.

答案1

得分: 1

以下是一些旧的知识库文章,提供了有关Neo4j如何使用内部信息的内容:

具体细节随时间可能已经发生变化,但上述内容至少可以让你对Neo4j的一些内部情况有所了解。

英文:

Here are a couple of old knowledge base articles that provide some internal information on how neo4j uses:

The details have probably changed over time, but the above should at least give you a feel for some of the neo4j internals.

答案2

得分: -1

不同的用例有不同的答案:加载、存储或检索数据?

对于加载,您可以使用CALL apoc.periodic.iterate。您可以设置每次迭代的文件大小,该文件不在内存中。这还具有恢复功能,如果连接中断。

在存储大型数据集时,架构尤为重要。初始加载可以后续进行分析,这些分析记录在知识图中(请查阅该主题)。这涉及添加新的节点、关系或属性,以提高性能。尽管涉及一些冗余和额外存储,但改进的效率使其合理化。

对于数据检索,考虑使用解开调用特性的子查询,通过对初始查询结果进行迭代来按顺序提取数据的批次。您可以将结果写入文件,而不使用内存来存储结果。

英文:

Different answer for differing use cases: loading, storage or retrieving data?

For loading you can use CALL apoc.periodic.iterate. You can set the size of each iteration of a file which is not in memory. This also has a recovery capability if the connection is interrupted.

The schema is particularly important in storing large data sets. The initial load can be followed by analytics which are memorialized in the knowledge graph (read up on that subject). This involves adding new nodes, relationships or properties which enhance performance. While it involved some redundancy and extra storage, the improved efficiency justifies this.

For data retrieval, consider subqueries using unwind-call features which iterate through the initial query result to pull out tranches of data sequentially in the subquery. You can write the results to a file and not use memory for the results.

huangapple
  • 本文由 发表于 2023年3月4日 03:45:35
  • 转载请务必保留本文链接:https://go.coder-hub.com/75631294.html
匿名

发表评论

匿名网友

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

确定