@sargonpiraev

Graph database

#database

A graph database stores data as nodes and edges.

The core idea is that relationships are first-class data. Instead of treating relationships as something reconstructed through joins, the database stores and traverses them directly.

Example

(User)-[:FOLLOWS]->(User)
(Person)-[:WORKS_AT]->(Company)
(Product)-[:SIMILAR_TO]->(Product)

The query often starts from one node and follows relationships.

What it is good for

Graph databases are useful for:

  • social graphs,
  • recommendations,
  • dependency networks,
  • fraud rings,
  • knowledge graphs,
  • relationship-heavy exploration.

Tradeoff

Graph databases make traversal natural, but they are not always the best fit for simple tabular reporting or high-volume analytical scans. For those workloads, a relational database or columnar database may be a better fit.