.NET Architecture & System Design Interview Question #68

What is a graph database?

Database Scaling, Partitioning, NoSQL & Data Consistency Mid-Level Intermediate

Quick Interview Answer

A graph database represents data as nodes and relationships and is optimized for traversing connections. It is useful when relationships are central to the queries, such as social networks, recommendation relationships, fraud analysis, or dependency graphs.

Detailed Explanation

A graph database represents data as nodes and relationships and is optimized for traversing connections. It is useful when relationships are central to the queries, such as social networks, recommendation relationships, fraud analysis, or dependency graphs.

A graph database is not automatically required whenever data has relationships. The decision depends on the depth and frequency of relationship traversal and the capabilities of alternative stores.

Code Example

(User)-[FOLLOWS]->(User)
(User)-[BOUGHT]->(Product)
(Product)-[RELATED_TO]->(Product)