SlideShare une entreprise Scribd logo
1  sur  62
Soffri di patologie da
"domini complessi con tante
relazioni"?
C'è una nuova cura:
Graph Database
Luca Garulli –
Founder and CEO
@Orient Technologies Ltd
Author of OrientDB
(c) Luca Garulli

www.twitter.com/lgarulli

Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License

Page 1
www.orientechnologies.com
1979
First Relational DBMS available as product

2009
NoSQL movement
(c) Luca Garulli

Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License

Page 2
1979
First Relational DBMS available as product

Hey, 30 years in the
IT field is so huge!

2009
NoSQL movement
(c) Luca Garulli

Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License

Page 3
Before 2009 teams of developers
always fought to select:
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

Page 4
One of the main resistances of
RDBMS users to pass to a NoSQL product
are related to the
complexity of the model:
Ok, NoSQL products are super for
BigData and BigScale
but...
(c) Luca Garulli

Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License

Page 5
...what about the model?

(c) Luca Garulli

Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License

Page 6
What is the NoSQL answer
about managing complex domains?

Key-Value stores ?
Column-Based ?
Document database ?
Graph database !
(c) Luca Garulli

Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License

Page 7
CAUTION!
This presentation will not use a
social like domain with
the classic paradigm of
friend-of-friendN
where the graph databases
are already widely used...
(c) Luca Garulli

Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License

Page 8
...But rather we will explore how
to think «graphically» with one of the
most common domains in the
enterprise world:
The old-classic CRM* domain
* today in 99% of the cases a RDBMS is used

(c) Luca Garulli

Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License

Page 9
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

Page 10
Back to school:
Graph Theory crash course

(c) Luca Garulli

Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License

Page 11
Basic Graph

Luca
Luca

(c) Luca Garulli

Likes

NoSQL
NoSQL
Day
Day

Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License

Page 12
Property Graph Model*
Vertices are
directed

Luca
Luca

Likes

name: Luca
name: Luca
surname: Garulli
surname: Garulli
company: Orient Tech
company: Orient Tech

since: 2013

NoSQL
NoSQL
Day
Day
date: Nov 15° 2013
date: Nov 15° 2013

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

Page 13
Property Graph Model
Likes
2
since:

Luca
Luca

013

Speak
s

NoSQL
NoSQL
Day
Day

ti
abstra tle: «Switch
in
ct: «Th
is talk g...»
presen
ts...»

An Edge connects 2
vertices: use multiple edges
to represents 1-N and N-M
relationships
(c) Luca Garulli

Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License

Page 14
Property Graph Model
Studies

Udine
Udine

Luca
Luca

located

Likes
FriendOf
Daniel
Daniel
(c) Luca Garulli

ganizes
Or
Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License

NoSQL
NoSQL
Day
Day

Page 15
Compliments, this is your diploma in
«Graph Theory»

(c) Luca Garulli

Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License

Page 16
Now go back
to our domain:
the CRM
(c) Luca Garulli

Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License

Page 17
Domain: the super minimal CRM
Customer
Customer

Address
Address

Registry system
Order system
Order
Order

(c) Luca Garulli

Stock
Stock

Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License

Page 18
Domain: the super minimal CRM
Customer
Customer

Address
Address

How does
Relational DBMS
manage relationships?

Registry system
Order system
Order
Order

(c) Luca Garulli

Stock
Stock

Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License

Page 19
Relational World: 1-1 Relationships
Primary key

Primary key
Customer

Id

Name

Address
Address

10 Luca

34

11 Jill

Foreign key

Id

Location

34

Rome

44

44

London

34 John

54

54

Moscow

56 Mark

66

66

New Mexico

88 Steve

68

68

Palo Alto

JOIN Customer.Address -> Address.Id
(c) Luca Garulli

Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License

Page 20
Relational World: 1-N Relationships
Customer
Id

Address

Name

Id

Customer

Location

10 Luca

24

10

Rome

11 Jill

33

10

London

34 John

44

34

Moscow

56 Mark

66

56

Cologne

88 Steve

68

88

Palo Alto

Inverse JOIN Address.Customer -> Customer.Id
(c) Luca Garulli

Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License

Page 21
Relational World: N-M Relationships
Customer
Id

Name

CustomerAddress
Id

Address

Address
Id

Location

10

Luca

10

24

24

Rome

11

Jill

10

33

33

London

34

John

34

44

44

Moscow

56

Mark

66

Cologne

88

Steve

68

Palo Alto

Additional table with 2 JOINs
(1) CustomerAddress.Id -> Customer.Id and
(2) CustomerAddress.Address -> Address.Id
(c) Luca Garulli

Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License

Page 22
What’s wrong with the
Relational Model?

(c) Luca Garulli

Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License

Page 23
The JOIN is the evil!
Customer
Id

CustomerAddress

Name

Id

Address

Address
Id

Location

10

Luca

10

24

24

Rome

11

Jill

10

33

33

London

34

John

34

24

44

Moscow

56

Mark

66

Cologne

88

Steve

68

Palo Alto

These are all JOINs executed
everytime you traverse a
relationship!
relationship
(c) Luca Garulli

Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License

Page 24
A JOIN means searching for a key in
another table
The first rule to improve performance
is indexing all the keys
Index speeds up searches, but slows down
insert, updates and deletes
(c) Luca Garulli

Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License

Page 25
So in the best case a JOIN is a lookup
into an index
This is done per 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

Page 26
Index Lookup
is it really that fast?
(c) Luca Garulli

Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License

Page 27
Index Lookup: how does it works?
A-Z
A-L

M-Z

Think to an
Address Book
where we have to find
the Luca’s phone
number

(c) Luca Garulli

Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License

Page 28
Index Lookup: how does it works?
A-Z
A-L

M-Z

A-L
A-D

M-Z
E-L

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

Page 29
Index Lookup: how does it works?
A-Z
A-L

M-Z

A-L
A-D

M-Z
E-L

M-R

A-D
A-B

(c) Luca Garulli

S-Z

E-L
C-D

E-G

H-L

Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License

Page 30
Index Lookup: how does it works?
A-Z
A-L

M-Z

A-L
A-D

M-Z
E-L

M-R

A-D
A-B

E-L
C-D

E-G

H-L

E-G
E-F

(c) Luca Garulli

S-Z

H-L
G

H-J

K-L

Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License

Page 31
Index Lookup: how does it works?
A-Z
A-L

M-Z

A-L
A-D

M-Z

E-L

A-D
A-B

Found!
M-R
S-Z
This lookup took 5
steps and grows
up with the index
size!

E-L
C-D

E-G

H-L

E-G
E-F

H-L
G

H-J

K-L

Luca
(c) Luca Garulli

Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License

Page 32
An index lookup is executed
for each JOIN
Querying more tables can easily
produce millions of JOINs/Lookups!
Here the rule: more entries
= more lookup steps = slower JOIN
(c) Luca Garulli

Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License

Page 33
Oh! This is why
performance of my database
drops down when
it becomes bigger,
and bigger,
and bigger!
(c) Luca Garulli

Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License

Page 34
Is there a better way to
manage relationships?

(c) Luca Garulli

Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License

Page 35
“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

Page 36
How does GraphDB manage
index-free relationships?

(c) Luca Garulli

Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License

Page 37
an Open Source (Apache licensed)
document-graph NoSQL dbms
(c) Luca Garulli

Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License

Page 38
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

Page 39
OrientDB: traverse a relationship
The Record ID (RID)
is the physical position

RID = #13:35
RID = #13:35

RID = #13:100
RID = #13:100

Luca
Luca

Rome
Rome

label : :‘Customer’
label ‘Customer’
name : :‘Luca’
name ‘Luca’

(c) Luca Garulli

label = ‘Address’
label = ‘Address’
name = ‘Rome’
name = ‘Rome’

Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License

Page 40
OrientDB: traverse a relationship
The Edge’s RID is saved
inside both vertices, as
«out» and «in»
RID = #13:35
RID = #13:35

RID = #13:100
RID = #13:100
RID = #14:54
RID = #14:54

Luca
Luca
out ::[#14:54]
out [#14:54]
label : :‘Customer’
label ‘Customer’
name : :‘Luca’
name ‘Luca’
(c) Luca Garulli

Lives
out: [#13:35]
out: [#13:35]
in: [#13:100]
in: [#13:100]
Label : :‘Lives’
Label ‘Lives’

Rome
Rome
in: [#14:54]
in: [#14:54]
label = ‘Address’
label = ‘Address’
name = ‘Rome’
name = ‘Rome’

Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License

Page 41
OrientDB: traverse a relationship

RID = #13:35
RID = #13:35

RID = #13:100
RID = #13:100
RID = #14:54
RID = #14:54

Luca
Luca
out ::[#14:54]
out [#14:54]
label : :‘Customer’
label ‘Customer’
name : :‘Luca’
name ‘Luca’
(c) Luca Garulli

Lives
out: [#13:35]
out: [#13:35]
in: [#13:100]
in: [#13:100]
Label : :‘Lives’
Label ‘Lives’

Rome
Rome
in: [#14:54]
in: [#14:54]
label = ‘Address’
label = ‘Address’
name = ‘Rome’
name = ‘Rome’

Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License

Page 42
OrientDB: traverse a relationship

RID = #13:35
RID = #13:35

RID = #13:100
RID = #13:100
RID = #14:54
RID = #14:54

Luca
Luca
out ::[#14:54]
out [#14:54]
label : :‘Customer’
label ‘Customer’
name : :‘Luca’
name ‘Luca’
(c) Luca Garulli

Lives
out: [#13:35]
out: [#13:35]
in: [#13:100]
in: [#13:100]
Label : :‘Lives’
Label ‘Lives’

Rome
Rome
in: [#14:54]
in: [#14:54]
label = ‘Address’
label = ‘Address’
name = ‘Rome’
name = ‘Rome’

Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License

Page 43
GraphDB handles relationships as a
physical LINK to the record
assigned when the edge is created
on the other side
RDBMS computes the
relationship every time you query a database

Is not that crazy?!
(c) Luca Garulli

Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License

Page 44
This means jumping from a
O(log N) algorithm to a near O(1)
traversing cost is not more 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

Page 45
OrientDB in the Blueprints micro-benchmark,
on common hw, with a hot cache,
traverses 29,6 Millions
of records in less than 5 seconds
about 6 Millions of nodes traversed per sec!
Do not try this at home
with a RDBMS*!
*unless you live in the Google’s server farm
(c) Luca Garulli

Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License

Page 46
Create the graph in SQL
$luca> cd bin
$luca> ./console.sh
OrientDB console v.1.3.0-SNAPSHOT (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

Page 47
Create the graph in Java
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();

(c) Luca Garulli

Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License

Page 48
Query the graph in SQL
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

(c) Luca Garulli

Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License

Page 49
More on query power
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 = ‘Udine’

(c) Luca Garulli

Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License

Page 50
Query vs traversal
Once you’ve a well connected database
in the form of a Super Graph you can
cross records instead of query them!
All you need is some root vertices
where to start traversing
(c) Luca Garulli

Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License

Page 51
Query vs traversal
Special
Special
Customers
Customers

Customers
Customers

Luca
Luca
This is a
root vertex

(c) Luca Garulli

Mar
Mar
k
k

Stocks
Stocks

Jill
Jill
White
White
Soap
Soap
Order
Order
2332
2332

Order
Order
8834
8834

Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License

Page 52
Temporal based graph
Calendar
Calendar

Year
Year
2013
2013

Month
Month
April 2013
April 2013

Day
Day
9/4/2013
9/4/2013

Hour
Hour
9/4/2013
9/4/2013
09:00
09:00

Order
Order
2332
2332
(c) Luca Garulli

Hour
Hour
9/4/2013
9/4/2013
10:00
10:00

Order
Order
2333
2333

Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License

Order
Order
2334
2334
Page 53
Location based graph
Location
Location

Country
Country
Italy
Italy

Region
Region
Lazio
Lazio

State
State
RM
RM

City
City
Fiumicino
Fiumicino

Order
Order
2332
2332
(c) Luca Garulli

City
City
Rome
Rome

Order
Order
2333
2333

Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License

Order
Order
2334
2334
Page 54
Mix & Merge graphs
Region
Region
Lazio
Lazio
Country
Country
Italy
Italy

State
State
RM
RM
City
City
Rome
Rome

City
City
Fiumicino
Fiumicino

Location
Location

Order
Order
2332
2332

Order
Order
2333
2333

Order
Order
2334
2334

Calendar
Calendar

Year
Year
2013
2013

(c) Luca Garulli

Hour
Hour
9/4/2013
9/4/2013
09:00
09:00
Month
Month
April 2013
April 2013

Hour
Hour
9/4/2013
9/4/2013
10:00
10:00
Day
Day
9/4/2013
9/4/2013

Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License

Page 55
This is your database

(c) Luca Garulli

Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License

Page 56
Get last customer bought ‘Barolo’
select last(out(‘Order’).in(‘Customer)) from Stock
where name = ‘Barolo’

#34:22

(c) Luca Garulli

Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License

Page 57
Get his’s country

select out(‘City’) from #34:22

Udine, Italy
#55:12

(c) Luca Garulli

Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License

Page 58
Get orders from that country

select in(‘Customer’) from #55:12

(c) Luca Garulli

Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License

Page 59
Let’s move like a
Spider
on the web

(c) Luca Garulli

Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License

Page 60
Subscribe using the
code “nosqlday”
to get 20% for all
NoSQLDay attendees!
(c) Luca Garulli

Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License

Page 61
Questions & (maybe) Answers
Luca Garulli

www.twitter.com/lgarulli

(c) Luca Garulli

Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License

Page 62

Contenu connexe

Similaire à Soffri di patologie da "domini complessi con tante relazioni"? C'è una nuova cura: Graph Database

Austin Data Geeks - Why relationships are cool but join sucks
Austin Data Geeks - Why relationships are cool but join sucksAustin Data Geeks - Why relationships are cool but join sucks
Austin Data Geeks - Why relationships are cool but join sucksOrient Technologies
 
210 - Software Population Pyramids: The Current and the Future of OSS Develop...
210 - Software Population Pyramids: The Current and the Future of OSS Develop...210 - Software Population Pyramids: The Current and the Future of OSS Develop...
210 - Software Population Pyramids: The Current and the Future of OSS Develop...ESEM 2014
 
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
 
10 kickass-technologies-modern-developers-love
10 kickass-technologies-modern-developers-love10 kickass-technologies-modern-developers-love
10 kickass-technologies-modern-developers-loveHamed Hatami
 
Innovation Without Asking Permission
Innovation Without Asking PermissionInnovation Without Asking Permission
Innovation Without Asking PermissionBart Blommaerts
 
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
 
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
 
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
 
OpenChain Mini-Summit May 2023
OpenChain Mini-Summit May 2023OpenChain Mini-Summit May 2023
OpenChain Mini-Summit May 2023Shane Coughlan
 
Blockchain Developer Geography 2023 by Electric Capital
Blockchain Developer Geography 2023 by Electric CapitalBlockchain Developer Geography 2023 by Electric Capital
Blockchain Developer Geography 2023 by Electric CapitalMariaShen2
 
Gdsc lbce offline accelerator meet -1
Gdsc lbce offline accelerator meet -1Gdsc lbce offline accelerator meet -1
Gdsc lbce offline accelerator meet -1Diksha71
 
EC Blockchain Dev Geo Report.pdf
EC Blockchain Dev Geo Report.pdfEC Blockchain Dev Geo Report.pdf
EC Blockchain Dev Geo Report.pdfMariaShen2
 
5/ GitHub Inner Source @ OPEN'16
5/ GitHub Inner Source @ OPEN'165/ GitHub Inner Source @ OPEN'16
5/ GitHub Inner Source @ OPEN'16Kangaroot
 
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
 
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
 
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
 
Crypto Developer Locations 2023 by Electric Capital
Crypto Developer Locations 2023 by Electric CapitalCrypto Developer Locations 2023 by Electric Capital
Crypto Developer Locations 2023 by Electric CapitalMariaShen2
 
AI and Design Vol. 2: Navigating the New Frontier - Morgenbooster
AI and Design Vol. 2: Navigating the New Frontier - MorgenboosterAI and Design Vol. 2: Navigating the New Frontier - Morgenbooster
AI and Design Vol. 2: Navigating the New Frontier - Morgenbooster1508 A/S
 

Similaire à Soffri di patologie da "domini complessi con tante relazioni"? C'è una nuova cura: Graph Database (20)

Austin Data Geeks - Why relationships are cool but join sucks
Austin Data Geeks - Why relationships are cool but join sucksAustin Data Geeks - Why relationships are cool but join sucks
Austin Data Geeks - Why relationships are cool but join sucks
 
210 - Software Population Pyramids: The Current and the Future of OSS Develop...
210 - Software Population Pyramids: The Current and the Future of OSS Develop...210 - Software Population Pyramids: The Current and the Future of OSS Develop...
210 - Software Population Pyramids: The Current and the Future of OSS Develop...
 
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...
 
10 kickass-technologies-modern-developers-love
10 kickass-technologies-modern-developers-love10 kickass-technologies-modern-developers-love
10 kickass-technologies-modern-developers-love
 
Innovation Without Asking Permission
Innovation Without Asking PermissionInnovation Without Asking Permission
Innovation Without Asking Permission
 
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...
 
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 ...
 
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...
 
OpenChain Mini-Summit May 2023
OpenChain Mini-Summit May 2023OpenChain Mini-Summit May 2023
OpenChain Mini-Summit May 2023
 
Blockchain Developer Geography 2023 by Electric Capital
Blockchain Developer Geography 2023 by Electric CapitalBlockchain Developer Geography 2023 by Electric Capital
Blockchain Developer Geography 2023 by Electric Capital
 
Gdsc lbce offline accelerator meet -1
Gdsc lbce offline accelerator meet -1Gdsc lbce offline accelerator meet -1
Gdsc lbce offline accelerator meet -1
 
EC Blockchain Dev Geo Report.pdf
EC Blockchain Dev Geo Report.pdfEC Blockchain Dev Geo Report.pdf
EC Blockchain Dev Geo Report.pdf
 
5/ GitHub Inner Source @ OPEN'16
5/ GitHub Inner Source @ OPEN'165/ GitHub Inner Source @ OPEN'16
5/ GitHub Inner Source @ OPEN'16
 
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...
 
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
 
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-...
 
Crypto Developer Locations 2023 by Electric Capital
Crypto Developer Locations 2023 by Electric CapitalCrypto Developer Locations 2023 by Electric Capital
Crypto Developer Locations 2023 by Electric Capital
 
AI and Design Vol. 2: Navigating the New Frontier - Morgenbooster
AI and Design Vol. 2: Navigating the New Frontier - MorgenboosterAI and Design Vol. 2: Navigating the New Frontier - Morgenbooster
AI and Design Vol. 2: Navigating the New Frontier - Morgenbooster
 

Plus de Luca Garulli

Scale Out Your Graph Across Servers and Clouds with OrientDB
Scale Out Your Graph Across Servers and Clouds  with OrientDBScale Out Your Graph Across Servers and Clouds  with OrientDB
Scale Out Your Graph Across Servers and Clouds with OrientDBLuca Garulli
 
Polyglot Persistence vs Multi-Model Databases
Polyglot Persistence vs Multi-Model DatabasesPolyglot Persistence vs Multi-Model Databases
Polyglot Persistence vs Multi-Model DatabasesLuca Garulli
 
How Graph Databases started the Multi Model revolution
How Graph Databases started the Multi Model revolutionHow Graph Databases started the Multi Model revolution
How Graph Databases started the Multi Model revolutionLuca Garulli
 
OrientDB and Hazelcast
OrientDB and HazelcastOrientDB and Hazelcast
OrientDB and HazelcastLuca Garulli
 
Switching from relational to the graph model
Switching from relational to the graph modelSwitching from relational to the graph model
Switching from relational to the graph modelLuca Garulli
 
OrientDB document or graph? Select the right model (old presentation)
OrientDB document or graph? Select the right model (old presentation)OrientDB document or graph? Select the right model (old presentation)
OrientDB document or graph? Select the right model (old presentation)Luca Garulli
 
OrientDB distributed architecture 1.1
OrientDB distributed architecture 1.1OrientDB distributed architecture 1.1
OrientDB distributed architecture 1.1Luca Garulli
 
OrientDB for real & Web App development
OrientDB for real & Web App developmentOrientDB for real & Web App development
OrientDB for real & Web App developmentLuca Garulli
 
OrientDB the database for the web 1.1
OrientDB the database for the web 1.1OrientDB the database for the web 1.1
OrientDB the database for the web 1.1Luca Garulli
 
Roma introduction and concepts
Roma introduction and conceptsRoma introduction and concepts
Roma introduction and conceptsLuca Garulli
 
OrientDB introduction - NoSQL
OrientDB introduction - NoSQLOrientDB introduction - NoSQL
OrientDB introduction - NoSQLLuca Garulli
 
RomaFramework Tutorial Basics
RomaFramework Tutorial BasicsRomaFramework Tutorial Basics
RomaFramework Tutorial BasicsLuca Garulli
 
Roma Meta Framework Concepts @JavaDay Rome 2007
Roma Meta Framework Concepts @JavaDay Rome 2007Roma Meta Framework Concepts @JavaDay Rome 2007
Roma Meta Framework Concepts @JavaDay Rome 2007Luca Garulli
 

Plus de Luca Garulli (13)

Scale Out Your Graph Across Servers and Clouds with OrientDB
Scale Out Your Graph Across Servers and Clouds  with OrientDBScale Out Your Graph Across Servers and Clouds  with OrientDB
Scale Out Your Graph Across Servers and Clouds with OrientDB
 
Polyglot Persistence vs Multi-Model Databases
Polyglot Persistence vs Multi-Model DatabasesPolyglot Persistence vs Multi-Model Databases
Polyglot Persistence vs Multi-Model Databases
 
How Graph Databases started the Multi Model revolution
How Graph Databases started the Multi Model revolutionHow Graph Databases started the Multi Model revolution
How Graph Databases started the Multi Model revolution
 
OrientDB and Hazelcast
OrientDB and HazelcastOrientDB and Hazelcast
OrientDB and Hazelcast
 
Switching from relational to the graph model
Switching from relational to the graph modelSwitching from relational to the graph model
Switching from relational to the graph model
 
OrientDB document or graph? Select the right model (old presentation)
OrientDB document or graph? Select the right model (old presentation)OrientDB document or graph? Select the right model (old presentation)
OrientDB document or graph? Select the right model (old presentation)
 
OrientDB distributed architecture 1.1
OrientDB distributed architecture 1.1OrientDB distributed architecture 1.1
OrientDB distributed architecture 1.1
 
OrientDB for real & Web App development
OrientDB for real & Web App developmentOrientDB for real & Web App development
OrientDB for real & Web App development
 
OrientDB the database for the web 1.1
OrientDB the database for the web 1.1OrientDB the database for the web 1.1
OrientDB the database for the web 1.1
 
Roma introduction and concepts
Roma introduction and conceptsRoma introduction and concepts
Roma introduction and concepts
 
OrientDB introduction - NoSQL
OrientDB introduction - NoSQLOrientDB introduction - NoSQL
OrientDB introduction - NoSQL
 
RomaFramework Tutorial Basics
RomaFramework Tutorial BasicsRomaFramework Tutorial Basics
RomaFramework Tutorial Basics
 
Roma Meta Framework Concepts @JavaDay Rome 2007
Roma Meta Framework Concepts @JavaDay Rome 2007Roma Meta Framework Concepts @JavaDay Rome 2007
Roma Meta Framework Concepts @JavaDay Rome 2007
 

Dernier

Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Scott Andery
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 

Dernier (20)

Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 

Soffri di patologie da "domini complessi con tante relazioni"? C'è una nuova cura: Graph Database

  • 1. Soffri di patologie da "domini complessi con tante relazioni"? C'è una nuova cura: Graph Database Luca Garulli – Founder and CEO @Orient Technologies Ltd Author of OrientDB (c) Luca Garulli www.twitter.com/lgarulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 1 www.orientechnologies.com
  • 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 Page 2
  • 3. 1979 First Relational DBMS available as product Hey, 30 years in the IT field is so huge! 2009 NoSQL movement (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 3
  • 4. Before 2009 teams of developers always fought to select: 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 Page 4
  • 5. One of the main resistances of RDBMS users to pass to a NoSQL product are related to the complexity of the model: Ok, NoSQL products are super for BigData and BigScale but... (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 5
  • 6. ...what about the model? (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 6
  • 7. What is the NoSQL answer about managing complex domains? Key-Value stores ? Column-Based ? Document database ? Graph database ! (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 7
  • 8. CAUTION! This presentation will not use a social like domain with the classic paradigm of friend-of-friendN where the graph databases are already widely used... (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 8
  • 9. ...But rather we will explore how to think «graphically» with one of the most common domains in the enterprise world: The old-classic CRM* domain * today in 99% of the cases a RDBMS is used (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 9
  • 10. 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 Page 10
  • 11. Back to school: Graph Theory crash course (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 11
  • 12. Basic Graph Luca Luca (c) Luca Garulli Likes NoSQL NoSQL Day Day Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 12
  • 13. Property Graph Model* Vertices are directed Luca Luca Likes name: Luca name: Luca surname: Garulli surname: Garulli company: Orient Tech company: Orient Tech since: 2013 NoSQL NoSQL Day Day date: Nov 15° 2013 date: Nov 15° 2013 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 Page 13
  • 14. Property Graph Model Likes 2 since: Luca Luca 013 Speak s NoSQL NoSQL Day Day ti abstra tle: «Switch in ct: «Th is talk g...» presen ts...» An Edge connects 2 vertices: use multiple edges to represents 1-N and N-M relationships (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 14
  • 15. Property Graph Model Studies Udine Udine Luca Luca located Likes FriendOf Daniel Daniel (c) Luca Garulli ganizes Or Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License NoSQL NoSQL Day Day Page 15
  • 16. Compliments, this is your diploma in «Graph Theory» (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 16
  • 17. Now go back to our domain: the CRM (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 17
  • 18. Domain: the super minimal CRM Customer Customer Address Address Registry system Order system Order Order (c) Luca Garulli Stock Stock Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 18
  • 19. Domain: the super minimal CRM Customer Customer Address Address How does Relational DBMS manage relationships? Registry system Order system Order Order (c) Luca Garulli Stock Stock Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 19
  • 20. Relational World: 1-1 Relationships Primary key Primary key Customer Id Name Address Address 10 Luca 34 11 Jill Foreign key Id Location 34 Rome 44 44 London 34 John 54 54 Moscow 56 Mark 66 66 New Mexico 88 Steve 68 68 Palo Alto JOIN Customer.Address -> Address.Id (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 20
  • 21. Relational World: 1-N Relationships Customer Id Address Name Id Customer Location 10 Luca 24 10 Rome 11 Jill 33 10 London 34 John 44 34 Moscow 56 Mark 66 56 Cologne 88 Steve 68 88 Palo Alto Inverse JOIN Address.Customer -> Customer.Id (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 21
  • 22. Relational World: N-M Relationships Customer Id Name CustomerAddress Id Address Address Id Location 10 Luca 10 24 24 Rome 11 Jill 10 33 33 London 34 John 34 44 44 Moscow 56 Mark 66 Cologne 88 Steve 68 Palo Alto Additional table with 2 JOINs (1) CustomerAddress.Id -> Customer.Id and (2) CustomerAddress.Address -> Address.Id (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 22
  • 23. What’s wrong with the Relational Model? (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 23
  • 24. The JOIN is the evil! Customer Id CustomerAddress Name Id Address Address Id Location 10 Luca 10 24 24 Rome 11 Jill 10 33 33 London 34 John 34 24 44 Moscow 56 Mark 66 Cologne 88 Steve 68 Palo Alto These are all JOINs executed everytime you traverse a relationship! relationship (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 24
  • 25. A JOIN means searching for a key in another table The first rule to improve performance is indexing all the keys Index speeds up searches, but slows down insert, updates and deletes (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 25
  • 26. So in the best case a JOIN is a lookup into an index This is done per 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 Page 26
  • 27. Index Lookup is it really that fast? (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 27
  • 28. Index Lookup: how does it works? A-Z A-L M-Z Think to an Address Book where we have to find the Luca’s phone number (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 28
  • 29. Index Lookup: how does it works? A-Z A-L M-Z A-L A-D M-Z E-L 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 Page 29
  • 30. Index Lookup: how does it works? A-Z A-L M-Z A-L A-D M-Z E-L M-R A-D A-B (c) Luca Garulli S-Z E-L C-D E-G H-L Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 30
  • 31. Index Lookup: how does it works? A-Z A-L M-Z A-L A-D M-Z E-L M-R A-D A-B E-L C-D E-G H-L E-G E-F (c) Luca Garulli S-Z H-L G H-J K-L Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 31
  • 32. Index Lookup: how does it works? A-Z A-L M-Z A-L A-D M-Z E-L A-D A-B Found! M-R S-Z This lookup took 5 steps and grows up with the index size! E-L C-D E-G H-L E-G E-F H-L G H-J K-L Luca (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 32
  • 33. An index lookup is executed for each JOIN Querying more tables can easily produce millions of JOINs/Lookups! Here the rule: more entries = more lookup steps = slower JOIN (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 33
  • 34. Oh! This is why performance of my database drops down when it becomes bigger, and bigger, and bigger! (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 34
  • 35. Is there a better way to manage relationships? (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 35
  • 36. “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 Page 36
  • 37. How does GraphDB manage index-free relationships? (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 37
  • 38. an Open Source (Apache licensed) document-graph NoSQL dbms (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 38
  • 39. 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 Page 39
  • 40. OrientDB: traverse a relationship The Record ID (RID) is the physical position RID = #13:35 RID = #13:35 RID = #13:100 RID = #13:100 Luca Luca Rome Rome label : :‘Customer’ label ‘Customer’ name : :‘Luca’ name ‘Luca’ (c) Luca Garulli label = ‘Address’ label = ‘Address’ name = ‘Rome’ name = ‘Rome’ Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 40
  • 41. OrientDB: traverse a relationship The Edge’s RID is saved inside both vertices, as «out» and «in» RID = #13:35 RID = #13:35 RID = #13:100 RID = #13:100 RID = #14:54 RID = #14:54 Luca Luca out ::[#14:54] out [#14:54] label : :‘Customer’ label ‘Customer’ name : :‘Luca’ name ‘Luca’ (c) Luca Garulli Lives out: [#13:35] out: [#13:35] in: [#13:100] in: [#13:100] Label : :‘Lives’ Label ‘Lives’ Rome Rome in: [#14:54] in: [#14:54] label = ‘Address’ label = ‘Address’ name = ‘Rome’ name = ‘Rome’ Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 41
  • 42. OrientDB: traverse a relationship RID = #13:35 RID = #13:35 RID = #13:100 RID = #13:100 RID = #14:54 RID = #14:54 Luca Luca out ::[#14:54] out [#14:54] label : :‘Customer’ label ‘Customer’ name : :‘Luca’ name ‘Luca’ (c) Luca Garulli Lives out: [#13:35] out: [#13:35] in: [#13:100] in: [#13:100] Label : :‘Lives’ Label ‘Lives’ Rome Rome in: [#14:54] in: [#14:54] label = ‘Address’ label = ‘Address’ name = ‘Rome’ name = ‘Rome’ Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 42
  • 43. OrientDB: traverse a relationship RID = #13:35 RID = #13:35 RID = #13:100 RID = #13:100 RID = #14:54 RID = #14:54 Luca Luca out ::[#14:54] out [#14:54] label : :‘Customer’ label ‘Customer’ name : :‘Luca’ name ‘Luca’ (c) Luca Garulli Lives out: [#13:35] out: [#13:35] in: [#13:100] in: [#13:100] Label : :‘Lives’ Label ‘Lives’ Rome Rome in: [#14:54] in: [#14:54] label = ‘Address’ label = ‘Address’ name = ‘Rome’ name = ‘Rome’ Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 43
  • 44. GraphDB handles relationships as a physical LINK to the record assigned when the edge is created on the other side RDBMS computes the relationship every time you query a database Is not that crazy?! (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 44
  • 45. This means jumping from a O(log N) algorithm to a near O(1) traversing cost is not more 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 Page 45
  • 46. OrientDB in the Blueprints micro-benchmark, on common hw, with a hot cache, traverses 29,6 Millions of records in less than 5 seconds about 6 Millions of nodes traversed per sec! Do not try this at home with a RDBMS*! *unless you live in the Google’s server farm (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 46
  • 47. Create the graph in SQL $luca> cd bin $luca> ./console.sh OrientDB console v.1.3.0-SNAPSHOT (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 Page 47
  • 48. Create the graph in Java 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(); (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 48
  • 49. Query the graph in SQL 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 (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 49
  • 50. More on query power 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 = ‘Udine’ (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 50
  • 51. Query vs traversal Once you’ve a well connected database in the form of a Super Graph you can cross records instead of query them! All you need is some root vertices where to start traversing (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 51
  • 52. Query vs traversal Special Special Customers Customers Customers Customers Luca Luca This is a root vertex (c) Luca Garulli Mar Mar k k Stocks Stocks Jill Jill White White Soap Soap Order Order 2332 2332 Order Order 8834 8834 Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 52
  • 53. Temporal based graph Calendar Calendar Year Year 2013 2013 Month Month April 2013 April 2013 Day Day 9/4/2013 9/4/2013 Hour Hour 9/4/2013 9/4/2013 09:00 09:00 Order Order 2332 2332 (c) Luca Garulli Hour Hour 9/4/2013 9/4/2013 10:00 10:00 Order Order 2333 2333 Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Order Order 2334 2334 Page 53
  • 54. Location based graph Location Location Country Country Italy Italy Region Region Lazio Lazio State State RM RM City City Fiumicino Fiumicino Order Order 2332 2332 (c) Luca Garulli City City Rome Rome Order Order 2333 2333 Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Order Order 2334 2334 Page 54
  • 55. Mix & Merge graphs Region Region Lazio Lazio Country Country Italy Italy State State RM RM City City Rome Rome City City Fiumicino Fiumicino Location Location Order Order 2332 2332 Order Order 2333 2333 Order Order 2334 2334 Calendar Calendar Year Year 2013 2013 (c) Luca Garulli Hour Hour 9/4/2013 9/4/2013 09:00 09:00 Month Month April 2013 April 2013 Hour Hour 9/4/2013 9/4/2013 10:00 10:00 Day Day 9/4/2013 9/4/2013 Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 55
  • 56. This is your database (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 56
  • 57. Get last customer bought ‘Barolo’ select last(out(‘Order’).in(‘Customer)) from Stock where name = ‘Barolo’ #34:22 (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 57
  • 58. Get his’s country select out(‘City’) from #34:22 Udine, Italy #55:12 (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 58
  • 59. Get orders from that country select in(‘Customer’) from #55:12 (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 59
  • 60. Let’s move like a Spider on the web (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 60
  • 61. Subscribe using the code “nosqlday” to get 20% for all NoSQLDay attendees! (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 61
  • 62. Questions & (maybe) Answers Luca Garulli www.twitter.com/lgarulli (c) Luca Garulli Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 62

Notes de l'éditeur

  1. Good afternoon! Today I’d like to show you a new way to design a database. In 1970 Relational DBMS