ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

Neo4j Fundamentals-Non-graph Databases to Graph

2022-05-04 14:00:12  阅读:197  来源: 互联网

标签:relationships Non Fundamentals Graph value graph model data


Neo4j Fundamentals

Graph Thinking

Property Graphs

Your First Graph

VIDEO

Non-graph Databases to Graph

VideoTranscript  

Benefit of Neo4j over Relational

As mentioned in the last lesson, index-free adjacency is a huge differentiator between relational and graph databases. While relationships are stored at write-time in a graph database, the joins made in a relational database are computed at read-time. This means that, as the number of records in a relational database increases, the slower the query becomes. The query time in a graph database will remain consistent to the size of the data that is actually touched during a query.

Having relationships treated as first class citizens also provides an advantage when starting out. Modelling relationships in a graph is more natural than creating pivot tables to represent many-to-many relationships.

Northwind RDBMS to graph

Let’s look at the Northwind RDBMS data model.

Northwind RDBMS model

In this example, an order can contain one or more products and a product can appear in one or more orders. In a relational database, the Order Details table is required to handle the many-to-many relationships. The more orders added, and subsequently the larger the Order Details table grows, the slower order queries will become.

Northwind as graph

In a graph, we can simply model a CONTAINS relationship from the Order node to each Product node. The Product node has a unit price property and the CONTAINS relationship which has properties to represent the quantity and discount.

NoSQL datastores to graph

NoSQL databases solve many of the problems, and they are great for write throughput.

But there are problems with how data is queried. The two most common NoSQL databases represent key/value stores and documents.

Key-value stores

Key-Value model

The key-value model is great and highly performant for lookups of huge amounts of simple or even complex values. Here is how a typical key-value store is structured.

Key-value as a graph

Key-Value as graph

However, when the values are themselves interconnected, you have a graph. Neo4j lets you traverse quickly among all the connected values and find insights in the relationships. The graph version shows how each key is related to a single value and how different values can be related to one another (like nodes connected to one another through relationships).

Document stores

Document model

The structured hierarchy of a Document model accommodates a lot of schema-free data that can easily be represented as a tree. Although trees are a type of graph, a tree represents only one projection or perspective of your data. This is how a document store hierarchy is structured as pieces within larger components.

Document model as graph

Document model as graph

If you refer to other documents (or contained elements) within that tree, you have a more expressive representation of the same data that you can easily navigate using a graph. A graph data model lets more than one natural representation emerge dynamically as needed. This graph version demonstrates how moving this data to a graph structure allows you to view different levels and details of the tree in different combinations.

Check your understanding

1. NoSQL datastores

As shown with the Northwind example, you learned that a Relational model can be implemented as a graph. What other NoSQL models have you learned about in this lesson that can be implemented as graphs to improve performance?

  • Object store

  • Key-value store

  • Tuple store

  • Document store

Native Graph Advantage 75% Your First Graph

标签:relationships,Non,Fundamentals,Graph,value,graph,model,data
来源: https://www.cnblogs.com/z-cm/p/16220967.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有