Approaching
Graph databases
Sergey	
  Enin	
  
So#ware	
  Engineering	
  Team	
  Leader	
  
EPAM,	
  Minsk	
  
AGENDA

NOSQL	
  

GRAPH	
  
DBs	
  

APP	
  

NEO4J	
  
NoSQL
NoSQL

Not Only SQL
Using	
  specific	
  toolset	
  for	
  specific	
  problem	
  

NoSQL	
  model	
  is	
  different	
  from	
  SQL	
  model	
  
NoSQL	
  databases	
  is	
  a	
  special	
  purpose	
  Database	
  	
  
(No)SQL: CLASSIFICATION
Database	
  

Data	
  model	
  

Strengths	
  

Weaks	
  

MySQL	
  

RelaBonal	
  

E-­‐R	
  data	
  model	
   Low	
  flexibility	
  

Redis	
  

Key-­‐value	
  

High	
  
performance	
  
and	
  scalability	
  

Low	
  funcKonality	
  

MongoDB	
  

Document	
  

High	
  
performance	
  

Variable	
  flexibility	
  

Cassandra	
  

Column	
  

High	
  
performance	
  
and	
  scalability	
  

Low	
  funcKonality	
  

Neo4j	
  

Graph	
  

High	
  
High	
  complexity	
  
performance	
  
Graph	
  Databases	
  

Graph
Databases
Graph Databases: HISTORY

Leonhard Euler (1707 –1783)
Swiss mathematician
Graph Databases: HISTORY
What is
Graph?
Graph Databases: GRAPH

A	
  

B	
  

VerKce	
  
(Node)	
  

C	
  

Edge	
  
(RelaKonship)	
  

D	
  
Graph Databases: WHAT IS IT?
Graph Databases: WHAT IS IT?

Joins	
  
VS	
  
Traversals	
  
Graph Databases: CHARACTERISTICS

1
Good for semistructured
connected
data

Index
freeadjacency

2

3
The
underlying
storage

The
processing
engine

4
APPs
ApplicaBon:	
  social	
  graphs	
  
Application: PAGE RANK
APP: Collaborative filtering
Neo4J: CHARACTERISTICS

	
  
true	
  ACID	
  transacKons;	
  
	
  
scales	
  to	
  billions	
  of	
  nodes	
  and	
  relaKonships;	
  
	
  
high	
  speed	
  querying	
  through	
  traversals;	
  
	
  
declaraKve	
  graph	
  query	
  language;	
  
Neo4J:	
   who	
   use	
  
Neo4J: WHO USE
it	
  
Neo4J:	
   who	
   use	
  
Neo4J: NETWORK ARCHITECTURE
it	
  
Neo4J:	
  network	
  architecture	
  
Neo4J:	
  architecture	
  
Neo4J: ARCHITECTURE
Neo4J:	
  architecture	
  
Neo4J: Internal storage

Node	
  

RelaKonship	
  
Neo4J:	
  architecture	
  
Neo4J: Internal storage
Neo4J: CYPHER
Neo4J: CYPHER
START	
  	
  
	
  usa=node:mb_fulltext(name="United	
  States"),	
  
	
  gb=node:mb_fulltext(name="United	
  Kingdom")	
  
MATCH	
  	
  
	
  (usa:Country),	
  (gb:Country),	
  
	
  (arKst:ArKst)-­‐[:FROM_AREA]-­‐(usa),	
  
	
  (arKst:ArKst)-­‐[:RECORDING_CONTRACT]-­‐(l:Label),	
  
	
  (label)-­‐[:FROM_AREA]-­‐(gb)	
  
RETURN	
  	
  
	
  arKst,label,usa,gb	
  
Thank You
Sergey Enin
Software Engineering Team Leader

Sergey_Enin@epam.com!

tygrysminsk!

sergeyenin!

pankrat!

sergeyenin.com/sec2014!

Approaching graph db