Course contentsShow
← System Design
Lesson 451 of 1,91913. NoSQL: Graph DatabasesFree lesson

What is a Graph Database?

Introduction to graph databases as systems optimized for storing and querying highly connected data using nodes and edges.

What is a Graph Database?

You'll learn how graph databases differ from other NoSQL models by storing relationships as first-class citizens, making them ideal for highly interconnected data.


The Core Idea

A graph database is a database system optimized for storing and querying data where relationships between entities are just as important as the entities themselves. Unlike document stores or wide-column stores that treat relationships as secondary concerns, graph databases model data using:

  • Nodes (also called vertices): Represent entities like people, products, or locations
  • Edges (also called relationships): Represent connections between nodes, like "follows," "purchased," or "located_in"
  • Properties: Key-value pairs attached to both nodes and edges

Think of a social network: each person is a node, and friendships are edges connecting them. Graph databases let you traverse these connections efficiently — finding "friends of friends" or "people within 3 degrees of connection" becomes natural and fast.

Why Graph Databases Matter

Traditional relational databases handle relationships through foreign keys and JOIN operations. As your data becomes more interconnected (think six or seven JOINs deep), query performance degrades significantly.

Graph databases store relationships natively alongside the data, making traversals — walking from node to node along edges — extremely efficient. Instead of expensive JOIN operations, you follow pointers that already exist in storage.

Use cases: social networks, recommendation engines, fraud detection rings, knowledge graphs, network topology, access control systems — anywhere connections between things are central to your queries.

Key Takeaway:
Graph databases excel at storing and querying highly connected data by treating relationships (edges) as first-class elements alongside entities (nodes), enabling fast traversal queries that would be slow in relational or other NoSQL systems.