Graph Model
Normalized Relational Model to Graph Model
- Entity-Tables become Nodes
- Foreign Keys become Relationships
- Link Tables become Relationships
- Remove artificial Primary Keys and Foreign Keys
Just use SQL
select movie.title from actors join actor_movie on (...) join movies on (...) where actors.name = "Andreas"
We traverse the graph
// find starting points MATCH (:Person {name:'Andreas'}) // then traverse the relationships -[:ACTED_IN]->(movie:Movie) <-[:ACTED_IN]-(other:Person) // and return results RETURN other
RDBMS can't handle relationships well
- Cannot model or store data and relationships without complexity
- Performance degrades with number and levels of relationships, and database size
- Query complexity grows with need for JOINs
- Adding new types of data and relationships requires schema redesign, increasing time to market
When data relationships are valuable in real-time traditional database aren't the best choice.
Express Complex Queries Easily with Cypher
Find all reports and how many people they manage, up to 3 levels down.
MATCH (boss)-[:MANAGES*0..3]->(mgr) WHERE boss.name = "John Doe" AND (mgr)-[:MANAGES]->() RETURN mgr.name as Manager, size((mgr)-[:MANAGES*1..3]->()) AS Total
Unlocking Value from Your Data Relationships
- Model your data naturally as a graph of data and relationships
- Drive graph model from domain and use-cases
- Use relationship information in real-time to transform your business
- Add new relationships on the fly to adapt to your changing requirements
High Query Performance with a Native Graph DB
- Relationships are first class citizen
- No need for joins, just follow pre-materialized relationships of nodes
- Query & Data-locality - navigate out from your starting points
- Only load what's needed
- Aggregate and project results as you go
- Optimized disk and memory model for graphs