SlideShare une entreprise Scribd logo
1  sur  96
Télécharger pour lire hors ligne
Switching from 
Relational to Graph 
Luca 
Garulli 
– 
Founder 
and 
CEO 
@Orient 
Model 
Technologies 
Ltd 
Author 
of 
OrientDB 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported Licewnwswe. o rien1technologies.com 
! 
www.twitter.com/lgarulli
1979 
First Relational DBMS available as product 
! 
! 
! 
! 
! 
! 
2009 
NoSQL movement 
! 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 2
1979 
First Relational DBMS available as product 
! 
! 
! 
! 
! 
! 
2009 
30 
yrs 
is 
a 
long 
time! 
NoSQL movement 
! 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 3
Before 2009, teams of developers 
always wanted a say in selecting: 
! 
Operative System 
Programming Language 
Middleware (App-Servers) 
! 
What about the Database? 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 4
One of the main reasons 
RDBMS users resist passing to NoSQL is 
related to the 
complexity of the RDBMS model: 
! 
NoSQL products are great for 
BigData and BigScale 
but... 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 5
…can it handle complexity? 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 6
What is the NoSQL answer 
for managing complex domains? 
! 
! 
Key-Value stores ? 
Column-Based ? 
Document database ? 
Graph database ! 
No Relationship 
support 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 7
Why don’t most NoSQL 
products support 
Relationships 
between entities? 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 8
To understand why, 
let’s see how 
Relational DBMS 
manages them 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 9
Domain: the super minimal “Selling App” 
Customer Address 
Order Stock 
Registry 
system 
Order 
system 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 10
Domain: the super minimal “Selling App” 
Customer Address 
Stock 
Registry 
system 
Order 
Order 
system 
How 
does 
Relational 
DBMS 
manage 
this 
relationship? 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 11
Relational World: 1-1 Relationships 
! 
! 
! 
! 
! 
! 
! 
! 
! 
Primary 
key Primary 
key 
Customer 
Id Name Address 
10 Luca 34 
11 Jill 44 
34 John 54 
56 Mark 66 
88 Steve 68 
Address 
Id Location 
34 Rome 
44 London 
54 Moscow 
66 New 
Mexico 
68 Palo 
Alto 
Foreign 
key 
JOIN Customer.Address -> Address.Id 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 12
Relational World: 1-N Relationships 
! 
! 
! 
! 
! 
! 
! 
! 
! 
Customer 
Id Name 
10 Luca 
11 Jill 
34 John 
56 Mark 
88 Steve 
Address 
Id Customer Location 
24 10 Rome 
33 10 London 
44 34 Moscow 
66 56 Cologne 
68 88 Palo 
Alto 
Inverse JOIN Address.Customer -> Customer.Id 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 13
Relational World: N-M Relationships 
! 
! 
! 
! 
! 
! 
! 
! 
CustomerAddress 
Id Address 
10 24 
10 33 
34 44 
Additional table with 2 JOINs 
Id Location 
24 Rome 
33 London 
44 Moscow 
66 Cologne 
68 Palo 
Alto 
(1) CustomerAddress.Id -> Customer.Id and 
(2) CustomerAddress.Address -> Address.Id 
Customer 
Id Name 
10 Luca 
11 Jill 
34 John 
56 Mark 
88 Steve 
Address 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 14
What’s wrong with the 
Relational Model? 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 15
The JOIN is evil! 
Customer 
Id Name 
10 Luca 
11 Jill 
34 John 
56 Mark 
88 Steve 
Address 
Id Location 
24 Rome 
33 London 
44 Moscow 
66 Cologne 
68 Palo 
Alto 
CustomerAddress 
Id Address 
10 24 
10 33 
34 24 
These 
JOINs 
are 
all 
executed 
every 
time 
you 
traverse 
a 
relationship 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 16
A JOIN means searching for a key in 
another table 
! 
The usual way to improve performance 
is to index all the keys 
! 
Indexing speeds up searches, but slows 
down inserts, updates and deletes 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 17
So a JOIN is essentially a lookup 
into an index 
! 
This is done for every single join! 
! 
If you traverse hundreds of relationships, 
you’re executing hundreds of JOINs 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 18
Index Lookup 
is it really that fast? 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 19
Index Lookup: how does it work? 
A-­‐Z 
A-­‐L M-­‐Z 
Imagine 
an 
Address 
Book 
where 
we 
want 
to 
find 
Luca’s 
phone 
number 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 20
Index Lookup: how does it work? 
A-­‐Z 
A-­‐L M-­‐Z 
A-­‐L 
A-­‐D E-­‐L 
M-­‐Z 
M-­‐R S-­‐Z 
Index 
algorithms 
are 
all 
similar 
and 
based 
on 
balanced 
trees 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 21
Index Lookup: how does it work? 
A-­‐Z 
A-­‐L M-­‐Z 
A-­‐L 
A-­‐D E-­‐L 
M-­‐Z 
M-­‐R S-­‐Z 
A-­‐D 
A-­‐B C-­‐D 
E-­‐L 
E-­‐G H-­‐L 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 22
Index Lookup: how does it work? 
A-­‐Z 
A-­‐L M-­‐Z 
A-­‐L 
A-­‐D E-­‐L 
M-­‐Z 
M-­‐R S-­‐Z 
A-­‐D 
A-­‐B C-­‐D 
E-­‐L 
E-­‐G H-­‐L 
E-­‐G 
E-­‐F G 
H-­‐L 
H-­‐J K-­‐L 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 23
Index Lookup: how does it work? 
A-­‐Z 
A-­‐L M-­‐Z 
A-­‐L 
A-­‐D E-­‐L 
M-­‐Z 
This 
lookup 
took 
M-­‐R S-­‐Z 
A-­‐D 
A-­‐B C-­‐D 
E-­‐L 
E-­‐G H-­‐L 
E-­‐G 
E-­‐F G 
H-­‐L 
H-­‐J K-­‐L 
Luca 
Found! 
5 
steps. 
With 
millions 
of 
indexed 
records, 
the 
tree 
depth 
could 
be 
1000’s 
of 
levels! 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 24
Can you imagine 
how many steps a 
Lookup operation takes for an 
Index with Billions 
of records? 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 25
And this JOIN is executed 
for every involved table, 
multiplied 
for all scanned records! 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 26
Querying more tables can easily 
produce millions of JOINs/Lookups! 
! 
Here’s the rule: 
more entries 
= more lookup steps 
= slower queries 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 27
AAhThis is why the 
query performance of your 
database suffers 
as the database 
becomes bigger, 
and bigger, 
and bigger! 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 28
What about 
Document Databases 
like MongoDB? 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 29
How MongoDB manages relationships: 
! 
{ 
“_id” : “292846512”, 
“type” : “Order”, 
“number” : 1223, 
“customer” : “123456789” 
} 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 30
MongoDB uses the 
same RDBMS approach: 
! 
it stores the _id of the connected 
documents. At run-time, it looks up 
the _id by using an index. 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 31
Is there a better way to 
manage relationships? 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 32
“A graph database is any 
storage system 
that provides 
index-free adjacency” 
! 
- Marko Rodriguez 
(author of TinkerPop Blueprints) 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 33
How does a GraphDB manage 
index-free relationships? 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 34
Every developer knows 
the Relational Model, 
but who knows the 
Graph one? 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 35
Back to school: 
Graph Theory crash course 
! 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 36
Basic Graph 
Likes 
Luca Austin 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 37
Property Graph Model* 
Luca 
! 
name: 
Luca 
surname: 
Garulli 
company: 
Orient 
Technologies 
! 
Austin 
! 
population: 
1,900,000 
Vertices 
are 
directed 
Likes 
since: 
2014 
Vertices 
and 
Edges 
can 
have 
properties 
* 
https://github.com/tinkerpop/blueprints/wiki/Property-­‐Graph-­‐Model 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 38
1-N relationships 
Luca 
! 
Austin 
Likes 
! 
since: 
2014 
when: 
An 
Edge 
connects 
only 
2 
vertices 
! 
Use 
multiple 
edges 
to 
represent 
1-­‐N 
and 
N-­‐M 
relationships 
Visited 
! 
[2013, 
2014] 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 39
Graph Example 
IsMemberOf 
Likes 
Luca 
Austin 
Data 
Geeks 
Hosts 
Austin 
Visited 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 40
Congrats! This is your diploma in 
«Graph Theory» 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 41
The Graph theory 
is so simple, 
yet so 
powerful 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 42
Let’s go back 
to the Graph Stuff 
! 
How does OrientDB 
manage relationships? 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 43
OrientDB: traverse a relationship 
The Record ID (RID) 
is the physical position 
RID 
= 
#13:35 RID 
= 
#13:100 
Luca 
(vertex) 
label 
: 
‘Customer’ 
name 
: 
‘Luca’ 
Rome 
(vertex) 
label 
= 
‘City’ 
name 
= 
‘Rome’ 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 44
OrientDB: traverse a relationship 
The Edge’s RID is saved 
inside both vertices, as «out» 
and «in» 
RID 
= 
#13:35 RID 
= 
#13:100 
RID 
= 
#14:54 
Lives 
Luca 
(vertex) 
out 
: 
[#14:54] 
label 
: 
‘Customer’ 
name 
: 
‘Luca’ 
out: 
[#13:35] 
in: 
[#13:100] 
Label 
: 
‘Lives’ 
Rome 
(vertex) 
in: 
[#14:54] 
label 
= 
‘City’ 
name 
= 
‘Rome’ 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 45
OrientDB: traverse -> outgoing 
RID 
= 
#13:35 
RID 
= 
#14:54 
Luca Lives 
out 
: 
[#14:54] 
label 
: 
‘Customer’ 
name 
: 
‘Luca’ 
out: 
[#13:35] 
in: 
[#13:100] 
Label 
: 
‘Lives’ 
RID 
= 
#13:100 
Rome 
in: 
[#14:54] 
label 
= 
‘City’ 
name 
= 
‘Rome’ 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 46
OrientDB: traverse <- incoming 
RID 
= 
#13:35 
RID 
= 
#14:54 
Luca Lives 
out 
: 
[#14:54] 
label 
: 
‘Customer’ 
name 
: 
‘Luca’ 
out: 
[#13:35] 
in: 
[#13:100] 
Label 
: 
‘Lives’ 
RID 
= 
#13:100 
Rome 
in: 
[#14:54] 
label 
= 
‘City’ 
name 
= 
‘Rome’ 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 47
A GraphDB handles relationships as a 
physical LINK to the record, 
assigned only when the edge is created 
! 
VS 
! 
RDBMS computes the 
relationship every time you query a database 
! 
Isn’t that crazy?! 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 48
This means jumping from a 
O(log N) algorithm to a near O(1) 
! 
With OrientDB, the traversing time is 
not affected by database size! 
! 
This is huge in the BigData age 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 49
an Open Source (Apache licensed) 
document-graph NoSQL dbms 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 50
OrientDB in the Blueprints micro-benchmark, 
on common hw, with a hot cache, 
traverses 29,6 Million 
records in less than 5 seconds 
! 
about 6 Million nodes traversed per sec! 
Do not try this at home 
! 
! 
! 
! 
with a RDBMS*! 
*unless you live in Google’s server farm 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 51
Create the graph in SQL 
! 
$luca> cd bin 
$luca> ./console.sh 
OrientDB console v.1.6.1 (www.orientdb.org) 
Type 'help' to display all the commands supported. 
! 
orientdb> create vertex Customer set name = ‘Luca’ 
Created vertex #13:35 in 0.03 secs 
! 
orientdb> create vertex Address set name = ‘Rome’ 
Created vertex #13:100 in 0.02 secs 
! 
orientdb> create edge Lives from #13:35 to #13:100 
Created edge #14:54 in 0.02 secs 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 52
Create the graph in Java 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 53 
!! 
Graph graph = new OrientGraph("local:/tmp/db/graph”); 
! 
Vertex luca = graph.addVertex( “class:Customer” ); 
luca.setProperty( “name", “Luca” ); 
! 
Vertex rome = graph.addVertex ( “class:Address” ); 
rome.setProperty( “name", “Rome” ); 
! 
Edge edge = luca.addEdge( “Lives”, rome ); 
! 
graph.shutdown();
Query the graph in SQL 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 54 
!!! 
orientdb> select in(‘Lives’) from Address where name = ‘Rome’ !! 
---+------+---------|--------------------+--------------------+--------+ 
#| RID |@class |label |out_Lives |in | 
---+------+---------+--------------------+--------------------+--------+ 
0| 13:35|Customer |Luca |[#14:54] | | 
---+------+---------+--------------------+--------------------+--------+ 
1 item(s) found. Query executed in 0.007 sec(s). 
Incoming vertices
More on query power 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 55 
!! 
orientdb> select sum( out(‘Order’).total ) from Customer 
where name = ‘Luca’ 
! 
orientdb> traverse both(‘Friend’) 
from Customer while $depth <= 7 
! 
orientdb> select from ( 
traverse both(‘Friend’) 
from Customer while $depth <= 7 
) where @class=‘Customer’ and city.name = ‘Austin’
Query vs traversal 
! 
With a well-connected database 
in the form of a Super Graph, you can 
cross records instead of query them! 
! 
All you need is a few “Root Vertices” 
to start traversing 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 56
Query vs traversal 
Customers 
Luca Mark Jill 
Order 
2332 
Order 
8834 
Stocks 
White 
Soap 
Special 
Customers 
This is a 
root vertex 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 57
Root Vertices can be enriched by 
Meta Graphs 
to decorate Graphs with 
additional information 
and make the retrieval 
easier/faster 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 58
Temporal based Meta Graph 
Day 
9/4/2013 
Order 
2333 
Order 
2334 
Calendar 
Hour 
9/4/2013 
10:00 
Month 
April 
2013 
Hour 
9/4/2013 
09:00 
Order 
2332 
Year 
2013 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 59
Location based Meta Graph 
State 
RM 
Order 
2333 
Order 
2334 
Location 
City 
Fiumicino 
Region 
Lazio 
City 
Rome 
Order 
2332 
Country 
Italy 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 60
Mix & Merge graphs 
State 
RM 
Order 
2333 
Order 
2334 
Location 
City 
Fiumicino 
City 
Rome 
Order 
2332 
Region 
Lazio 
Country 
Italy 
Calendar 
Hour 
9/4/2013 
10:00 
Hour 
9/4/2013 
09:00 
Day 
9/4/2013 
Month 
April 
2013 
Year 
2013 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 61
State 
RM 
Get all the orders 
sold in “Rome” 
on 9/4/2013 at 10:Order 
2333 
00 
Order 
2334 
Location 
City 
Rome 
! 
! 
City 
Fiumicino 
Order 
2332 
Region 
Lazio 
Country 
Italy 
Calendar 
Hour 
9/4/2013 
10:00 
Hour 
9/4/2013 
09:00 
Day 
9/4/2013 
Month 
April 
2013 
Year 
2013 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 62
Start from Calendar, look for Hour 10:00 
State 
RM 
Order 
2333 
Order 
2334 
Location 
City 
Fiumicino 
City 
Rome 
Order 
2332 
Region 
Lazio 
Country 
Italy 
Calendar 
Hour 
9/4/2013 
10:00 
Hour 
9/4/2013 
09:00 
Day 
9/4/2013 
Month 
April 
2013 
Year 
2013 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 63
Start from Calendar, look for Hour 10:00 
Found Found 2 2 Orders, Orders, now filter filter 
by 
State 
RM 
by incoming incoming edges< 
edges 
Order 
2333 
Order 
2334 
Location 
City 
Rome 
City 
Rome 
Order 
2332 
Region 
Lazio 
Country 
Italy 
Calendar 
Hour 
9/4/2013 
10:00 
Hour 
9/4/2013 
09:00 
Day 
9/4/2013 
Month 
April 
2013 
Year 
2013 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 64
Start from Calendar, look for Hour 10:00 
State 
RM 
Order 
2333 
Location 
City 
Rome 
Order 
2332 
Region 
Lazio 
Country 
Italy 
Only “Order 2333” has 
incoming connections with 
Calendar 
City 
Fiumicino 
Hour 
9/4/2013 
10:00 
Hour 
9/4/2013 
09:00 
Day 
9/4/2013 
Month 
April 
2013 
Year 
2013 
Order 
2334 
“Rome” 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 65
Or start from Location, look for Rome 
State 
RM 
Order 
2333 
Location 
City 
Rome 
Order 
2332 
Region 
Lazio 
Country 
Italy 
Calendar 
City 
Fiumicino 
Hour 
9/4/2013 
10:00 
Hour 
9/4/2013 
09:00 
Day 
9/4/2013 
Month 
April 
2013 
Year 
2013 
Order 
2334 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 66
Start from Location, look for Rome 
State 
RM 
Order 
2333 
City 
Rome 
Order 
2332 
Location 
Calendar 
City 
Fiumicino 
Hour 
9/4/2013 
10:00 
Hour 
9/4/2013 
09:00 
Day 
9/4/2013 
Region 
Lazio 
Month 
April 
2013 
Year 
2013 
Order 
2334 
Country 
Italy 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 67
Recommendation system 
Luca 
Jill 
Enrico 
Friend 
Friend 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 68
Recommendation system 
Salt 
Lick 
Eats 
Luca 
Pappasito's 
Jill 
Enrico 
Hut’s 
Burgers 
Friend 
Friend 
Eats 
Eats 
Eats 
Franklin’s 
BBQ 
Eats 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 69
Recommendation system 
select 
both(‘Friend’) 
Salt 
Lick 
from 
Person 
where 
name 
= 
‘Luca’ 
Eats 
Luca 
Pappasito's 
Jill 
Enrico 
Hut’s 
Burgers 
Friend 
Friend 
Eats 
Eats 
Eats 
Franklin’s 
BBQ 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 70
Recommendation system 
select 
both(‘Friend’).out(‘Eats’) 
from 
Person 
where 
name 
= 
‘Luca’ 
Da 
Carlone 
Eats 
Luca 
Meridionale 
Pappasito's 
Jill 
Enrico 
Hut’s 
La 
Burgers 
Mediterranea 
Friend 
Salt 
Lick 
Friend 
Eats 
Eats 
Eats 
Franklin’s 
Eaitaly 
BBQ 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 71
Recommendation system 
select 
both(‘Friend’).out(‘Eats’) 
Salt 
Lick 
from 
Person 
where 
name 
= 
‘Luca’ 
Eats 
Luca 
Pappasito's 
Jill 
Enrico 
Hut’s 
Burgers 
Friend 
Friend 
Eats 
Eats 
Eats 
Franklin’s 
BBQ 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 72
Let’s move like a 
Spider 
on the web 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 73
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 74
OrientDB is a Graph - Document DBMS 
Document Graph 
It provides the flexibility and speed of a document 
store combined with the advanced relationship 
features of a graph database 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 75
! 
Download 
Installation 
in 5 minutes 
! 
Unzip 
! 
Run 
You only need a JVM installed to run the server 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 76
200,000 
documents per second 
(no index, multi-threads, on commodity hw) 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 77
Schema-less 
! 
schema is not mandatory, relaxed model, 
collect heterogeneous documents all together 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 78
Schema-full 
! 
schema with constraints on fields and validation rules 
! 
Customer.age > 17 
Customer.address not null 
Customer.surname is mandatory 
Customer.email matches 'b[A-Z0-9._%+-]+@[A-Z0-9.-]+.[A-Z]{2,4}b' 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 79
Schema-mixed 
! 
schema with mandatory and optional fields 
+ constraints 
= the best of schema-less and schema-full modes 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 80
ACID Transactions 
!! 
db.begin(); 
try { 
// your code 
... 
db.commit(); 
! 
} catch( Exception e ) { 
db.rollback(); 
} 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 81
SQL 
! 
select * from employee where name like '%Jay%' 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 82
Why reinvent 
yet another language when 
almost all developers already 
know SQL? 
! 
OrientDB uses SQL 
but extends it adding new 
operators for graph manipulation 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 83
For most of the queries 
a programmer uses everyday 
SQL is simpler, 
more readable and 
compact then 
Scripting (Map/Reduce) 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 84
Native 
JSON 
!! 
ODocument = new ODocument().fromJSON( " 
{ 
'@rid' = '26:10', 
'@class' = 'Developer', 
'name' : 'Luca', 
'surname' : 'Garulli', 
'out' : [ #10:33, #10:232 ] 
}“ ); 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 85
Feature 
matrix 
FEATURES ORIENTDB)) MONGODB NEO4J MYSQL) 
(RDBMS) 
Operational Database X X X 
Graph Database X X 
Document Database X X 
Object-Oriented Concepts X 
Schema-full, Schema-less, Schema mix X 
User and Role & Record Level Security X 
Record Level Locking X X X 
SQL X X 
ACID Transaction X X X 
Relationships (Linked Documents) X X X 
Custom Data Types X X X 
Embedded Documents X X 
Multi-Master Zero Configuration Replication X 
Sharding X X 
Server Side Functions X X X 
Native HTTP Rest/ JSON X X 
Embeddable with No Restrictions X 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 86
Free 
! 
Open Source Apache 2 license 
free for any purpose, 
even commercial 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 87
Show time! 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 88
Ready to try OrientDB? 
! 
Start from the ETL 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 89
OrientDB 
ETL 
{ 
"extractor" : { 
"jdbc": { "driver": "com.mysql.jdbc.Driver", 
"url": "jdbc:mysql://localhost/mysqlcrm", 
"userName": "root", 
"userPassword": "", 
"query": "select * from Client" } 
}, 
"transformers" : [ 
{ "vertex": { "class": "Client"} } 
], 
"loader" : { 
"orientdb": { 
"dbURL": "plocal:/temp/databases/orientdbcrm", 
"dbAutoCreate": true 
} 
} 
} 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 90
./oetl.sh mydb.json 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 91
Drivers 
Contribute to build or improve a library! 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 92
Professional Services by 
! 
! 
LTD 
LTD 
(London, 
UK) 
Development Support 
Production Support 
Training 
Consultancy 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 93
We’re 
looking 
for 
worldwide 
partners 
Write 
to 
info@orientechnologies.com 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 94
http://www.orientechnologies.com/why-­‐orientdb 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 95
www.orientechnologies.com 
Thanks! 
Luca 
Garulli 
– 
Founder 
and 
CEO 
! 
www.twitter.com/lgarulli 
(c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 96

Contenu connexe

Similaire à Austin Data Geeks - Why relationships are cool but join sucks

Why relationships are cool but join sucks - Big Data & Graphs in Rome
Why relationships are cool but join sucks - Big Data & Graphs in RomeWhy relationships are cool but join sucks - Big Data & Graphs in Rome
Why relationships are cool but join sucks - Big Data & Graphs in RomeLuca Garulli
 
Soffri di patologie da "domini complessi con tante relazioni"? C'è una nuova ...
Soffri di patologie da "domini complessi con tante relazioni"? C'è una nuova ...Soffri di patologie da "domini complessi con tante relazioni"? C'è una nuova ...
Soffri di patologie da "domini complessi con tante relazioni"? C'è una nuova ...Luca Garulli
 
Why relationships are cool but "join" sucks
Why relationships are cool but "join" sucksWhy relationships are cool but "join" sucks
Why relationships are cool but "join" sucksLuca Garulli
 
Design your application using Persistent Graphs and OrientDB
Design your application using Persistent Graphs and OrientDBDesign your application using Persistent Graphs and OrientDB
Design your application using Persistent Graphs and OrientDBLuca Garulli
 
Switching from the Relational to the Graph model
Switching from the Relational to the Graph modelSwitching from the Relational to the Graph model
Switching from the Relational to the Graph modelLuca Garulli
 
fOSSa 2013 - Building innovation momentum, getting things started from nexus ...
fOSSa 2013 - Building innovation momentum, getting things started from nexus ...fOSSa 2013 - Building innovation momentum, getting things started from nexus ...
fOSSa 2013 - Building innovation momentum, getting things started from nexus ...SpagoWorld
 
O365Con18 - Create an Immersive Experience with Office365 Data and Mixed Real...
O365Con18 - Create an Immersive Experience with Office365 Data and Mixed Real...O365Con18 - Create an Immersive Experience with Office365 Data and Mixed Real...
O365Con18 - Create an Immersive Experience with Office365 Data and Mixed Real...NCCOMMS
 
O365 and SharePoint Connect - Create an immersive experience with office 365...
O365 and SharePoint Connect  - Create an immersive experience with office 365...O365 and SharePoint Connect  - Create an immersive experience with office 365...
O365 and SharePoint Connect - Create an immersive experience with office 365...Alexander Meijers
 
Open source from disruption to innovation - Can we measure and evaluate the o...
Open source from disruption to innovation - Can we measure and evaluate the o...Open source from disruption to innovation - Can we measure and evaluate the o...
Open source from disruption to innovation - Can we measure and evaluate the o...SpagoWorld
 
DIGITAL DISRUPTION: an open platform for digital economy between creative inn...
DIGITAL DISRUPTION: an open platform for digital economy between creative inn...DIGITAL DISRUPTION: an open platform for digital economy between creative inn...
DIGITAL DISRUPTION: an open platform for digital economy between creative inn...SpagoWorld
 
Meetup OpenTelemetry Intro
Meetup OpenTelemetry IntroMeetup OpenTelemetry Intro
Meetup OpenTelemetry IntroDimitrisFinas1
 
Handle your Lambdas - From event-based processing to Continuous Integration /...
Handle your Lambdas - From event-based processing to Continuous Integration /...Handle your Lambdas - From event-based processing to Continuous Integration /...
Handle your Lambdas - From event-based processing to Continuous Integration /...Sergii Khomenko
 
Innovation Without Asking Permission
Innovation Without Asking PermissionInnovation Without Asking Permission
Innovation Without Asking PermissionBart Blommaerts
 
Summarize the What Is Web 2.0
Summarize the What Is Web 2.0Summarize the What Is Web 2.0
Summarize the What Is Web 2.0wacerone
 
Integrating Telegram Bots with Ruby on Rails
Integrating Telegram Bots with Ruby on RailsIntegrating Telegram Bots with Ruby on Rails
Integrating Telegram Bots with Ruby on RailsChris Downey
 
Using Clojure, NoSQL Databases and Functional-Style JavaScript to Write Gext-...
Using Clojure, NoSQL Databases and Functional-Style JavaScript to Write Gext-...Using Clojure, NoSQL Databases and Functional-Style JavaScript to Write Gext-...
Using Clojure, NoSQL Databases and Functional-Style JavaScript to Write Gext-...Stefan Richter
 
2018-10-18 J2 2D - Create an immersive experience with Office 365 data and mi...
2018-10-18 J2 2D - Create an immersive experience with Office 365 data and mi...2018-10-18 J2 2D - Create an immersive experience with Office 365 data and mi...
2018-10-18 J2 2D - Create an immersive experience with Office 365 data and mi...Modern Workplace Conference Paris
 
Modern workplace conference create an immersive experience with office 365 ...
Modern workplace conference   create an immersive experience with office 365 ...Modern workplace conference   create an immersive experience with office 365 ...
Modern workplace conference create an immersive experience with office 365 ...Alexander Meijers
 
Getting Multi-chain Web3 data with One Unified API
Getting Multi-chain Web3 data with One Unified APIGetting Multi-chain Web3 data with One Unified API
Getting Multi-chain Web3 data with One Unified APITinaBregovi
 

Similaire à Austin Data Geeks - Why relationships are cool but join sucks (20)

Why relationships are cool but join sucks - Big Data & Graphs in Rome
Why relationships are cool but join sucks - Big Data & Graphs in RomeWhy relationships are cool but join sucks - Big Data & Graphs in Rome
Why relationships are cool but join sucks - Big Data & Graphs in Rome
 
Soffri di patologie da "domini complessi con tante relazioni"? C'è una nuova ...
Soffri di patologie da "domini complessi con tante relazioni"? C'è una nuova ...Soffri di patologie da "domini complessi con tante relazioni"? C'è una nuova ...
Soffri di patologie da "domini complessi con tante relazioni"? C'è una nuova ...
 
Why relationships are cool but "join" sucks
Why relationships are cool but "join" sucksWhy relationships are cool but "join" sucks
Why relationships are cool but "join" sucks
 
Design your application using Persistent Graphs and OrientDB
Design your application using Persistent Graphs and OrientDBDesign your application using Persistent Graphs and OrientDB
Design your application using Persistent Graphs and OrientDB
 
Switching from the Relational to the Graph model
Switching from the Relational to the Graph modelSwitching from the Relational to the Graph model
Switching from the Relational to the Graph model
 
Innovation & Massive data
Innovation & Massive dataInnovation & Massive data
Innovation & Massive data
 
fOSSa 2013 - Building innovation momentum, getting things started from nexus ...
fOSSa 2013 - Building innovation momentum, getting things started from nexus ...fOSSa 2013 - Building innovation momentum, getting things started from nexus ...
fOSSa 2013 - Building innovation momentum, getting things started from nexus ...
 
O365Con18 - Create an Immersive Experience with Office365 Data and Mixed Real...
O365Con18 - Create an Immersive Experience with Office365 Data and Mixed Real...O365Con18 - Create an Immersive Experience with Office365 Data and Mixed Real...
O365Con18 - Create an Immersive Experience with Office365 Data and Mixed Real...
 
O365 and SharePoint Connect - Create an immersive experience with office 365...
O365 and SharePoint Connect  - Create an immersive experience with office 365...O365 and SharePoint Connect  - Create an immersive experience with office 365...
O365 and SharePoint Connect - Create an immersive experience with office 365...
 
Open source from disruption to innovation - Can we measure and evaluate the o...
Open source from disruption to innovation - Can we measure and evaluate the o...Open source from disruption to innovation - Can we measure and evaluate the o...
Open source from disruption to innovation - Can we measure and evaluate the o...
 
DIGITAL DISRUPTION: an open platform for digital economy between creative inn...
DIGITAL DISRUPTION: an open platform for digital economy between creative inn...DIGITAL DISRUPTION: an open platform for digital economy between creative inn...
DIGITAL DISRUPTION: an open platform for digital economy between creative inn...
 
Meetup OpenTelemetry Intro
Meetup OpenTelemetry IntroMeetup OpenTelemetry Intro
Meetup OpenTelemetry Intro
 
Handle your Lambdas - From event-based processing to Continuous Integration /...
Handle your Lambdas - From event-based processing to Continuous Integration /...Handle your Lambdas - From event-based processing to Continuous Integration /...
Handle your Lambdas - From event-based processing to Continuous Integration /...
 
Innovation Without Asking Permission
Innovation Without Asking PermissionInnovation Without Asking Permission
Innovation Without Asking Permission
 
Summarize the What Is Web 2.0
Summarize the What Is Web 2.0Summarize the What Is Web 2.0
Summarize the What Is Web 2.0
 
Integrating Telegram Bots with Ruby on Rails
Integrating Telegram Bots with Ruby on RailsIntegrating Telegram Bots with Ruby on Rails
Integrating Telegram Bots with Ruby on Rails
 
Using Clojure, NoSQL Databases and Functional-Style JavaScript to Write Gext-...
Using Clojure, NoSQL Databases and Functional-Style JavaScript to Write Gext-...Using Clojure, NoSQL Databases and Functional-Style JavaScript to Write Gext-...
Using Clojure, NoSQL Databases and Functional-Style JavaScript to Write Gext-...
 
2018-10-18 J2 2D - Create an immersive experience with Office 365 data and mi...
2018-10-18 J2 2D - Create an immersive experience with Office 365 data and mi...2018-10-18 J2 2D - Create an immersive experience with Office 365 data and mi...
2018-10-18 J2 2D - Create an immersive experience with Office 365 data and mi...
 
Modern workplace conference create an immersive experience with office 365 ...
Modern workplace conference   create an immersive experience with office 365 ...Modern workplace conference   create an immersive experience with office 365 ...
Modern workplace conference create an immersive experience with office 365 ...
 
Getting Multi-chain Web3 data with One Unified API
Getting Multi-chain Web3 data with One Unified APIGetting Multi-chain Web3 data with One Unified API
Getting Multi-chain Web3 data with One Unified API
 

Dernier

AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesVictorSzoltysek
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrainmasabamasaba
 
%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durbanmasabamasaba
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...masabamasaba
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfayushiqss
 
Generic or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisionsGeneric or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisionsBert Jan Schrijver
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfkalichargn70th171
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfonteinmasabamasaba
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrandmasabamasaba
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyviewmasabamasaba
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...masabamasaba
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...masabamasaba
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park masabamasaba
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is insideshinachiaurasa2
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionOnePlan Solutions
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Hararemasabamasaba
 

Dernier (20)

AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
 
Generic or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisionsGeneric or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisions
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 

Austin Data Geeks - Why relationships are cool but join sucks

  • 1. Switching from Relational to Graph Luca Garulli – Founder and CEO @Orient Model Technologies Ltd Author of OrientDB (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported Licewnwswe. o rien1technologies.com ! www.twitter.com/lgarulli
  • 2. 1979 First Relational DBMS available as product ! ! ! ! ! ! 2009 NoSQL movement ! (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 2
  • 3. 1979 First Relational DBMS available as product ! ! ! ! ! ! 2009 30 yrs is a long time! NoSQL movement ! (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 3
  • 4. Before 2009, teams of developers always wanted a say in selecting: ! Operative System Programming Language Middleware (App-Servers) ! What about the Database? (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 4
  • 5. One of the main reasons RDBMS users resist passing to NoSQL is related to the complexity of the RDBMS model: ! NoSQL products are great for BigData and BigScale but... (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 5
  • 6. …can it handle complexity? (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 6
  • 7. What is the NoSQL answer for managing complex domains? ! ! Key-Value stores ? Column-Based ? Document database ? Graph database ! No Relationship support (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 7
  • 8. Why don’t most NoSQL products support Relationships between entities? (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 8
  • 9. To understand why, let’s see how Relational DBMS manages them (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 9
  • 10. Domain: the super minimal “Selling App” Customer Address Order Stock Registry system Order system (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 10
  • 11. Domain: the super minimal “Selling App” Customer Address Stock Registry system Order Order system How does Relational DBMS manage this relationship? (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 11
  • 12. Relational World: 1-1 Relationships ! ! ! ! ! ! ! ! ! Primary key Primary key Customer Id Name Address 10 Luca 34 11 Jill 44 34 John 54 56 Mark 66 88 Steve 68 Address Id Location 34 Rome 44 London 54 Moscow 66 New Mexico 68 Palo Alto Foreign key JOIN Customer.Address -> Address.Id (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 12
  • 13. Relational World: 1-N Relationships ! ! ! ! ! ! ! ! ! Customer Id Name 10 Luca 11 Jill 34 John 56 Mark 88 Steve Address Id Customer Location 24 10 Rome 33 10 London 44 34 Moscow 66 56 Cologne 68 88 Palo Alto Inverse JOIN Address.Customer -> Customer.Id (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 13
  • 14. Relational World: N-M Relationships ! ! ! ! ! ! ! ! CustomerAddress Id Address 10 24 10 33 34 44 Additional table with 2 JOINs Id Location 24 Rome 33 London 44 Moscow 66 Cologne 68 Palo Alto (1) CustomerAddress.Id -> Customer.Id and (2) CustomerAddress.Address -> Address.Id Customer Id Name 10 Luca 11 Jill 34 John 56 Mark 88 Steve Address (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 14
  • 15. What’s wrong with the Relational Model? (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 15
  • 16. The JOIN is evil! Customer Id Name 10 Luca 11 Jill 34 John 56 Mark 88 Steve Address Id Location 24 Rome 33 London 44 Moscow 66 Cologne 68 Palo Alto CustomerAddress Id Address 10 24 10 33 34 24 These JOINs are all executed every time you traverse a relationship (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 16
  • 17. A JOIN means searching for a key in another table ! The usual way to improve performance is to index all the keys ! Indexing speeds up searches, but slows down inserts, updates and deletes (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 17
  • 18. So a JOIN is essentially a lookup into an index ! This is done for every single join! ! If you traverse hundreds of relationships, you’re executing hundreds of JOINs (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 18
  • 19. Index Lookup is it really that fast? (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 19
  • 20. Index Lookup: how does it work? A-­‐Z A-­‐L M-­‐Z Imagine an Address Book where we want to find Luca’s phone number (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 20
  • 21. Index Lookup: how does it work? A-­‐Z A-­‐L M-­‐Z A-­‐L A-­‐D E-­‐L M-­‐Z M-­‐R S-­‐Z Index algorithms are all similar and based on balanced trees (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 21
  • 22. Index Lookup: how does it work? A-­‐Z A-­‐L M-­‐Z A-­‐L A-­‐D E-­‐L M-­‐Z M-­‐R S-­‐Z A-­‐D A-­‐B C-­‐D E-­‐L E-­‐G H-­‐L (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 22
  • 23. Index Lookup: how does it work? A-­‐Z A-­‐L M-­‐Z A-­‐L A-­‐D E-­‐L M-­‐Z M-­‐R S-­‐Z A-­‐D A-­‐B C-­‐D E-­‐L E-­‐G H-­‐L E-­‐G E-­‐F G H-­‐L H-­‐J K-­‐L (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 23
  • 24. Index Lookup: how does it work? A-­‐Z A-­‐L M-­‐Z A-­‐L A-­‐D E-­‐L M-­‐Z This lookup took M-­‐R S-­‐Z A-­‐D A-­‐B C-­‐D E-­‐L E-­‐G H-­‐L E-­‐G E-­‐F G H-­‐L H-­‐J K-­‐L Luca Found! 5 steps. With millions of indexed records, the tree depth could be 1000’s of levels! (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 24
  • 25. Can you imagine how many steps a Lookup operation takes for an Index with Billions of records? (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 25
  • 26. And this JOIN is executed for every involved table, multiplied for all scanned records! (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 26
  • 27. Querying more tables can easily produce millions of JOINs/Lookups! ! Here’s the rule: more entries = more lookup steps = slower queries (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 27
  • 28. AAhThis is why the query performance of your database suffers as the database becomes bigger, and bigger, and bigger! (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 28
  • 29. What about Document Databases like MongoDB? (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 29
  • 30. How MongoDB manages relationships: ! { “_id” : “292846512”, “type” : “Order”, “number” : 1223, “customer” : “123456789” } (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 30
  • 31. MongoDB uses the same RDBMS approach: ! it stores the _id of the connected documents. At run-time, it looks up the _id by using an index. (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 31
  • 32. Is there a better way to manage relationships? (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 32
  • 33. “A graph database is any storage system that provides index-free adjacency” ! - Marko Rodriguez (author of TinkerPop Blueprints) (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 33
  • 34. How does a GraphDB manage index-free relationships? (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 34
  • 35. Every developer knows the Relational Model, but who knows the Graph one? (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 35
  • 36. Back to school: Graph Theory crash course ! (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 36
  • 37. Basic Graph Likes Luca Austin (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 37
  • 38. Property Graph Model* Luca ! name: Luca surname: Garulli company: Orient Technologies ! Austin ! population: 1,900,000 Vertices are directed Likes since: 2014 Vertices and Edges can have properties * https://github.com/tinkerpop/blueprints/wiki/Property-­‐Graph-­‐Model (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 38
  • 39. 1-N relationships Luca ! Austin Likes ! since: 2014 when: An Edge connects only 2 vertices ! Use multiple edges to represent 1-­‐N and N-­‐M relationships Visited ! [2013, 2014] (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 39
  • 40. Graph Example IsMemberOf Likes Luca Austin Data Geeks Hosts Austin Visited (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 40
  • 41. Congrats! This is your diploma in «Graph Theory» (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 41
  • 42. The Graph theory is so simple, yet so powerful (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 42
  • 43. Let’s go back to the Graph Stuff ! How does OrientDB manage relationships? (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 43
  • 44. OrientDB: traverse a relationship The Record ID (RID) is the physical position RID = #13:35 RID = #13:100 Luca (vertex) label : ‘Customer’ name : ‘Luca’ Rome (vertex) label = ‘City’ name = ‘Rome’ (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 44
  • 45. OrientDB: traverse a relationship The Edge’s RID is saved inside both vertices, as «out» and «in» RID = #13:35 RID = #13:100 RID = #14:54 Lives Luca (vertex) out : [#14:54] label : ‘Customer’ name : ‘Luca’ out: [#13:35] in: [#13:100] Label : ‘Lives’ Rome (vertex) in: [#14:54] label = ‘City’ name = ‘Rome’ (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 45
  • 46. OrientDB: traverse -> outgoing RID = #13:35 RID = #14:54 Luca Lives out : [#14:54] label : ‘Customer’ name : ‘Luca’ out: [#13:35] in: [#13:100] Label : ‘Lives’ RID = #13:100 Rome in: [#14:54] label = ‘City’ name = ‘Rome’ (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 46
  • 47. OrientDB: traverse <- incoming RID = #13:35 RID = #14:54 Luca Lives out : [#14:54] label : ‘Customer’ name : ‘Luca’ out: [#13:35] in: [#13:100] Label : ‘Lives’ RID = #13:100 Rome in: [#14:54] label = ‘City’ name = ‘Rome’ (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 47
  • 48. A GraphDB handles relationships as a physical LINK to the record, assigned only when the edge is created ! VS ! RDBMS computes the relationship every time you query a database ! Isn’t that crazy?! (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 48
  • 49. This means jumping from a O(log N) algorithm to a near O(1) ! With OrientDB, the traversing time is not affected by database size! ! This is huge in the BigData age (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 49
  • 50. an Open Source (Apache licensed) document-graph NoSQL dbms (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 50
  • 51. OrientDB in the Blueprints micro-benchmark, on common hw, with a hot cache, traverses 29,6 Million records in less than 5 seconds ! about 6 Million nodes traversed per sec! Do not try this at home ! ! ! ! with a RDBMS*! *unless you live in Google’s server farm (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 51
  • 52. Create the graph in SQL ! $luca> cd bin $luca> ./console.sh OrientDB console v.1.6.1 (www.orientdb.org) Type 'help' to display all the commands supported. ! orientdb> create vertex Customer set name = ‘Luca’ Created vertex #13:35 in 0.03 secs ! orientdb> create vertex Address set name = ‘Rome’ Created vertex #13:100 in 0.02 secs ! orientdb> create edge Lives from #13:35 to #13:100 Created edge #14:54 in 0.02 secs (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 52
  • 53. Create the graph in Java (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 53 !! Graph graph = new OrientGraph("local:/tmp/db/graph”); ! Vertex luca = graph.addVertex( “class:Customer” ); luca.setProperty( “name", “Luca” ); ! Vertex rome = graph.addVertex ( “class:Address” ); rome.setProperty( “name", “Rome” ); ! Edge edge = luca.addEdge( “Lives”, rome ); ! graph.shutdown();
  • 54. Query the graph in SQL (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 54 !!! orientdb> select in(‘Lives’) from Address where name = ‘Rome’ !! ---+------+---------|--------------------+--------------------+--------+ #| RID |@class |label |out_Lives |in | ---+------+---------+--------------------+--------------------+--------+ 0| 13:35|Customer |Luca |[#14:54] | | ---+------+---------+--------------------+--------------------+--------+ 1 item(s) found. Query executed in 0.007 sec(s). Incoming vertices
  • 55. More on query power (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 55 !! orientdb> select sum( out(‘Order’).total ) from Customer where name = ‘Luca’ ! orientdb> traverse both(‘Friend’) from Customer while $depth <= 7 ! orientdb> select from ( traverse both(‘Friend’) from Customer while $depth <= 7 ) where @class=‘Customer’ and city.name = ‘Austin’
  • 56. Query vs traversal ! With a well-connected database in the form of a Super Graph, you can cross records instead of query them! ! All you need is a few “Root Vertices” to start traversing (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 56
  • 57. Query vs traversal Customers Luca Mark Jill Order 2332 Order 8834 Stocks White Soap Special Customers This is a root vertex (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 57
  • 58. Root Vertices can be enriched by Meta Graphs to decorate Graphs with additional information and make the retrieval easier/faster (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 58
  • 59. Temporal based Meta Graph Day 9/4/2013 Order 2333 Order 2334 Calendar Hour 9/4/2013 10:00 Month April 2013 Hour 9/4/2013 09:00 Order 2332 Year 2013 (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 59
  • 60. Location based Meta Graph State RM Order 2333 Order 2334 Location City Fiumicino Region Lazio City Rome Order 2332 Country Italy (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 60
  • 61. Mix & Merge graphs State RM Order 2333 Order 2334 Location City Fiumicino City Rome Order 2332 Region Lazio Country Italy Calendar Hour 9/4/2013 10:00 Hour 9/4/2013 09:00 Day 9/4/2013 Month April 2013 Year 2013 (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 61
  • 62. State RM Get all the orders sold in “Rome” on 9/4/2013 at 10:Order 2333 00 Order 2334 Location City Rome ! ! City Fiumicino Order 2332 Region Lazio Country Italy Calendar Hour 9/4/2013 10:00 Hour 9/4/2013 09:00 Day 9/4/2013 Month April 2013 Year 2013 (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 62
  • 63. Start from Calendar, look for Hour 10:00 State RM Order 2333 Order 2334 Location City Fiumicino City Rome Order 2332 Region Lazio Country Italy Calendar Hour 9/4/2013 10:00 Hour 9/4/2013 09:00 Day 9/4/2013 Month April 2013 Year 2013 (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 63
  • 64. Start from Calendar, look for Hour 10:00 Found Found 2 2 Orders, Orders, now filter filter by State RM by incoming incoming edges< edges Order 2333 Order 2334 Location City Rome City Rome Order 2332 Region Lazio Country Italy Calendar Hour 9/4/2013 10:00 Hour 9/4/2013 09:00 Day 9/4/2013 Month April 2013 Year 2013 (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 64
  • 65. Start from Calendar, look for Hour 10:00 State RM Order 2333 Location City Rome Order 2332 Region Lazio Country Italy Only “Order 2333” has incoming connections with Calendar City Fiumicino Hour 9/4/2013 10:00 Hour 9/4/2013 09:00 Day 9/4/2013 Month April 2013 Year 2013 Order 2334 “Rome” (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 65
  • 66. Or start from Location, look for Rome State RM Order 2333 Location City Rome Order 2332 Region Lazio Country Italy Calendar City Fiumicino Hour 9/4/2013 10:00 Hour 9/4/2013 09:00 Day 9/4/2013 Month April 2013 Year 2013 Order 2334 (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 66
  • 67. Start from Location, look for Rome State RM Order 2333 City Rome Order 2332 Location Calendar City Fiumicino Hour 9/4/2013 10:00 Hour 9/4/2013 09:00 Day 9/4/2013 Region Lazio Month April 2013 Year 2013 Order 2334 Country Italy (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 67
  • 68. Recommendation system Luca Jill Enrico Friend Friend (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 68
  • 69. Recommendation system Salt Lick Eats Luca Pappasito's Jill Enrico Hut’s Burgers Friend Friend Eats Eats Eats Franklin’s BBQ Eats (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 69
  • 70. Recommendation system select both(‘Friend’) Salt Lick from Person where name = ‘Luca’ Eats Luca Pappasito's Jill Enrico Hut’s Burgers Friend Friend Eats Eats Eats Franklin’s BBQ (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 70
  • 71. Recommendation system select both(‘Friend’).out(‘Eats’) from Person where name = ‘Luca’ Da Carlone Eats Luca Meridionale Pappasito's Jill Enrico Hut’s La Burgers Mediterranea Friend Salt Lick Friend Eats Eats Eats Franklin’s Eaitaly BBQ (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 71
  • 72. Recommendation system select both(‘Friend’).out(‘Eats’) Salt Lick from Person where name = ‘Luca’ Eats Luca Pappasito's Jill Enrico Hut’s Burgers Friend Friend Eats Eats Eats Franklin’s BBQ (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 72
  • 73. Let’s move like a Spider on the web (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 73
  • 74. (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 74
  • 75. OrientDB is a Graph - Document DBMS Document Graph It provides the flexibility and speed of a document store combined with the advanced relationship features of a graph database (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 75
  • 76. ! Download Installation in 5 minutes ! Unzip ! Run You only need a JVM installed to run the server (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 76
  • 77. 200,000 documents per second (no index, multi-threads, on commodity hw) (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 77
  • 78. Schema-less ! schema is not mandatory, relaxed model, collect heterogeneous documents all together (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 78
  • 79. Schema-full ! schema with constraints on fields and validation rules ! Customer.age > 17 Customer.address not null Customer.surname is mandatory Customer.email matches 'b[A-Z0-9._%+-]+@[A-Z0-9.-]+.[A-Z]{2,4}b' (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 79
  • 80. Schema-mixed ! schema with mandatory and optional fields + constraints = the best of schema-less and schema-full modes (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 80
  • 81. ACID Transactions !! db.begin(); try { // your code ... db.commit(); ! } catch( Exception e ) { db.rollback(); } (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 81
  • 82. SQL ! select * from employee where name like '%Jay%' (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 82
  • 83. Why reinvent yet another language when almost all developers already know SQL? ! OrientDB uses SQL but extends it adding new operators for graph manipulation (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 83
  • 84. For most of the queries a programmer uses everyday SQL is simpler, more readable and compact then Scripting (Map/Reduce) (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 84
  • 85. Native JSON !! ODocument = new ODocument().fromJSON( " { '@rid' = '26:10', '@class' = 'Developer', 'name' : 'Luca', 'surname' : 'Garulli', 'out' : [ #10:33, #10:232 ] }“ ); (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 85
  • 86. Feature matrix FEATURES ORIENTDB)) MONGODB NEO4J MYSQL) (RDBMS) Operational Database X X X Graph Database X X Document Database X X Object-Oriented Concepts X Schema-full, Schema-less, Schema mix X User and Role & Record Level Security X Record Level Locking X X X SQL X X ACID Transaction X X X Relationships (Linked Documents) X X X Custom Data Types X X X Embedded Documents X X Multi-Master Zero Configuration Replication X Sharding X X Server Side Functions X X X Native HTTP Rest/ JSON X X Embeddable with No Restrictions X (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 86
  • 87. Free ! Open Source Apache 2 license free for any purpose, even commercial (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 87
  • 88. Show time! (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 88
  • 89. Ready to try OrientDB? ! Start from the ETL (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 89
  • 90. OrientDB ETL { "extractor" : { "jdbc": { "driver": "com.mysql.jdbc.Driver", "url": "jdbc:mysql://localhost/mysqlcrm", "userName": "root", "userPassword": "", "query": "select * from Client" } }, "transformers" : [ { "vertex": { "class": "Client"} } ], "loader" : { "orientdb": { "dbURL": "plocal:/temp/databases/orientdbcrm", "dbAutoCreate": true } } } (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 90
  • 91. ./oetl.sh mydb.json (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 91
  • 92. Drivers Contribute to build or improve a library! (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 92
  • 93. Professional Services by ! ! LTD LTD (London, UK) Development Support Production Support Training Consultancy (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 93
  • 94. We’re looking for worldwide partners Write to info@orientechnologies.com (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 94
  • 95. http://www.orientechnologies.com/why-­‐orientdb (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 95
  • 96. www.orientechnologies.com Thanks! Luca Garulli – Founder and CEO ! www.twitter.com/lgarulli (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License 96