Databases Reference
In-Depth Information
relational database to store your list of friends, you can produce a list of your friends
sorted by their last name. But if you use a graph store, you can not only get a list of your
friends by their last name, you can also get a list of which friends are most likely to buy
you a beer! Graph stores don't just tell you there's a relationship—they can give you
detailed reports about each of your relationships.
Graph nodes are usually representations of real-world objects like nouns. Nodes
can be people, organizations, telephone numbers, web pages, computers on a net-
work, or even biological cells in a living organism. The relationships can be thought of
as connections between these objects and are typically represented as arcs (lines that
connect) between circles in diagrams.
Graph queries are similar to traversing nodes in a graph. You can query to ask
things like these:
What's the shortest path between two nodes in a graph?
What nodes have neighboring nodes that have specific properties?
Given any two nodes in a graph, how similar are their neighboring nodes?
What's the average connectedness of various points on a graph with each other?
As you saw in chapter 2, RDBMS s use artificial numbers as primary and foreign keys to
relate rows in tables that are stored on different sections of a single hard drive. Per-
forming a join operation in RDBMS s is expensive in terms of latency as well as disk
input and output. Graph stores relate nodes together, understanding that two nodes
with the same identifiers are the same node. Graph stores assign internal identifiers to
nodes and use those identifiers to join networks together. But unlike RDBMS s, graph
store joins are computationally lightweight and fast. This speed is attributed to the
small nature of each node and the ability to keep graph data in RAM , which means
once the graph is loaded into memory, retrieving the data doesn't require disk input
and output operations.
Unlike other NoSQL patterns we'll discuss in this chapter, graph stores are difficult
to scale out on multiple servers due to the close connectedness of each node in a
graph. Data can be replicated on multiple servers to enhance read and query perfor-
mance, but writes to multiple servers and graph queries that span multiple nodes can
be complex to implement.
Although graph stores are built around the simple and general-purpose node-
relationship-node data structure, graph stores come with their own complex and
inconsistent jargon when they're used in different ways. You'll find that you interact
with graph stores in much the same way you do other types of databases. For example,
you'll load, query, update, and delete data. The difference is found in the types of
queries you use. A graph query will return a set of nodes that are used to create a
graph image on the screen to show you the relationship between your data.
Search WWH ::




Custom Search