SlideShare a Scribd company logo
1 of 27
Download to read offline
Document rev 1.1




          Select the right model

           „Document vs Graph,
           what is the answer?“
© Luca Garulli - 2012   Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License      Page 1
OrientDB supports multiple models


                              Document
                                Graph
                            Custom Graph*


                                         *available in 1.2

© Luca Garulli - 2012   Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License   Page 2
What is the best choice for my domain?

© Luca Garulli - 2012   Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License   Page 3
Facts
        Graph Model has been built on top of
               the Document Model

                        But why it is so fast?
       Because in OrientDB relationships are
         direct links, not relational JOINs
© Luca Garulli - 2012      Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License   Page 4
This is the reason why
   even using the Document model
   you can manage complex graphs
               of objects


© Luca Garulli - 2012   Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License   Page 5
Relationships



© Luca Garulli - 2012   Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License   Page 6
Graph Model
                                     Vertex & Edges I

                                                                                    in
                        Vertex                                                                Vertex
                          A                                                                     B
                                     out




                             Connections using
                             bidirectional Edges




© Luca Garulli - 2012            Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License   Page 7
Graph Model
                                Vertex & Edges II

                                                                                       in
               Vertex                                                                          Vertex
                                               Edge A-B
                 A                                                                               B
                          out




                        Edges in OrientDB are records
                         with own RecordID of class
                        «OGraphEdge» or just «E» as
                                    alias.


© Luca Garulli - 2012      Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License   Page 8
Graph Model
                               Vertex & Edges III

                        out*                                               in
               Vertex                                                                         Vertex
                                              Edge A-B
                 A                                                                              B
                                 out                                                * in



         To access to the ougoing vertices use «out.in» because:

         1. Vertex A exits through «out» to go to the
         2. Edge, and then
         3. «in» to arrive to the Vertex B

© Luca Garulli - 2012     Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License   Page 9
Graph Model
                                           summary

                        connect vertices using edges

              A vertex has "in" for the incoming
           relationships and "out" for the outgoing
                         relationships

                          are always bidirectional

© Luca Garulli - 2012      Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License   Page 10
Document Model
                        oneway direct connections

                                                                      students *
                  Professor                                                            Student
                     Jay                                                                Steve




                            Connections are
                         directed without using
                         Edges and are always
                            monodirectional


© Luca Garulli - 2012       Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License   Page 11
Document Model
                        express the cardinality

                                                                    students *
                  Professor                                                          Student
                     Jay                                                              Steve

                                  Students = N
                               Using LINKSET type                                 city 1


                                                                                       City
                                                                                     Palo Alto
                                            City = 1
                                        Using LINK type

© Luca Garulli - 2012     Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License   Page 12
Document Model
                        express the cardinality

                                                                    students *
                  Professor                                                          Student
                     Jay                                                              Steve



                          Use LINKSET or LINKMAP for
                           unordered collection doesn’t
                           accept duplicates, otherwise
                            LINKLIST as ordered with
                                   duplicated


© Luca Garulli - 2012     Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License   Page 13
Document Model
                        bidirectional connections
                                                                               students *



                  Professor                                                            Student
                     Jay                                                                Steve

                        professors *



    To create bidirectional links create
             2 relationships:
      1. from Professor to Student
      2. from Student to Professor

© Luca Garulli - 2012       Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License   Page 14
Document Model
                                        summary

        Connections are always as oneway, to have a
       bidirectional relationship create 2 connections

                         Single cardinality: LINK

                Multiple cardinality:
  LINKSET and LINKMAP for unordered, no duplicates
       and LINKLIST: ordered allows duplicates

© Luca Garulli - 2012   Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License   Page 15
Graph Model
                                                    vs
                        Document Model


© Luca Garulli - 2012    Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License   Page 16
Graph Model
                                              PROS
 1. Ability to use GREMLIN and full TinkerPop
    Blueprints stack

 2. Connections are always bidirectional: leave open
    the ability to move in all the directions even is
    not planned at the beginning

 3. Edges can have properties

© Luca Garulli - 2012   Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License   Page 17
Graph Model
                                             CONS
1. Edges are record themselves, so db is bigger: one
   record more per edge

2. Traversing between Vertices needs to load the
   Edge record too, so it‘s slower

3. All the outgoing relationships are inside the "out"
   collection: worst performance in case you have
   connections of different kind
© Luca Garulli - 2012   Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License   Page 18
Document Model
                                              PROS
1. Lighter than Graph Model, no need for a separate
   record to manage relationships

2. Faster on traversing because links are directing
   bypassing the Edge records

3. Finer grained cardinality setting also the
   relationship type

© Luca Garulli - 2012    Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License   Page 19
Document Model
                                              CONS
1. Cannot use the GREMLIN and full TinkerPop
   Blueprints stack

2. No native bidirectional connection, so the
   application has to manage the double connection

3. Edges cannot have properties


© Luca Garulli - 2012    Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License   Page 20
Suggestions
                                  What to use?

   Graph and Document models have PROS
   and CONS. Often it‘s hard to select the
    right one because there couldn‘t be a
                  right one.

    The next use cases are very generics so
     don‘t take them as rule of the thumb
© Luca Garulli - 2012   Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License   Page 21
Suggestions
                        (1) Social Applications

     Highly suggested the Graph Model because
    you‘re always ready to analyze the graph in
       any direction using advanced tools like
                 GREMLIN language.

    Graph algorithm already developed through
    TinkerPop stack like Shortest Path, Ranking,
                        etc.
© Luca Garulli - 2012    Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License   Page 22
Suggestions
                    (2) CRM/Business Applications

      You could select both. Here the Document
          Model is a good candidate because
     relationships don‘t change so often and are
            mostly known at the beginning




© Luca Garulli - 2012    Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License   Page 23
Suggestions
                        (3) Highest performance

        Since the Graph Model is heavier because
        requires more records and more traverse
             time, the suggested here is the
                    Document Model




© Luca Garulli - 2012     Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License   Page 24
© Luca Garulli - 2012   Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License   Page 25
NuvolaBase.com
                                                    The first
                                                 Graph Database
                                                  on the Cloud
                                                     always available
                                                 few seconds to setup it
                                                use it from Web & Mobile
                                                           apps

© Luca Garulli - 2012   Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License   Page 26
Luca Garulli
                        Author of                                                    CEO at


          Document-Graph NoSQL
            Open Source project
                                                                             Ltd, London UK




  www.twitter.com/lgarulli
© Luca Garulli - 2012      Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License   Page 27

More Related Content

What's hot

AWS re:Invent 2016: Strategic Planning for Long-Term Data Archiving with Amaz...
AWS re:Invent 2016: Strategic Planning for Long-Term Data Archiving with Amaz...AWS re:Invent 2016: Strategic Planning for Long-Term Data Archiving with Amaz...
AWS re:Invent 2016: Strategic Planning for Long-Term Data Archiving with Amaz...Amazon Web Services
 
第29回 SQL Server 勉強会 (JSSUG) - Azure Synapse Analytics 概要
第29回 SQL Server 勉強会 (JSSUG) - Azure Synapse Analytics 概要 第29回 SQL Server 勉強会 (JSSUG) - Azure Synapse Analytics 概要
第29回 SQL Server 勉強会 (JSSUG) - Azure Synapse Analytics 概要 Daiyu Hatakeyama
 
Tadx - Présentation Conteneurisation
Tadx -  Présentation ConteneurisationTadx -  Présentation Conteneurisation
Tadx - Présentation ConteneurisationTADx
 
Redis overview for Software Architecture Forum
Redis overview for Software Architecture ForumRedis overview for Software Architecture Forum
Redis overview for Software Architecture ForumChristopher Spring
 
Les éléments d'indexation dans la DTD-EAD
Les éléments d'indexation dans la DTD-EADLes éléments d'indexation dans la DTD-EAD
Les éléments d'indexation dans la DTD-EADDanis Habib
 
[B15] HiRDBのSQL実行プランはどのように決定しているのか?by Masaaki Narita
[B15] HiRDBのSQL実行プランはどのように決定しているのか?by Masaaki Narita[B15] HiRDBのSQL実行プランはどのように決定しているのか?by Masaaki Narita
[B15] HiRDBのSQL実行プランはどのように決定しているのか?by Masaaki NaritaInsight Technology, Inc.
 
Oracle E-Business Suite R12.2.6 on Database 12c: Install, Patch and Administer
Oracle E-Business Suite R12.2.6 on Database 12c: Install, Patch and AdministerOracle E-Business Suite R12.2.6 on Database 12c: Install, Patch and Administer
Oracle E-Business Suite R12.2.6 on Database 12c: Install, Patch and AdministerAndrejs Karpovs
 
MyDUMPER : Faster logical backups and restores
MyDUMPER : Faster logical backups and restores MyDUMPER : Faster logical backups and restores
MyDUMPER : Faster logical backups and restores Mydbops
 
ぐるなびが活用するElastic Cloud
ぐるなびが活用するElastic Cloudぐるなびが活用するElastic Cloud
ぐるなびが活用するElastic CloudElasticsearch
 
Big data application architecture 요약2
Big data application architecture 요약2Big data application architecture 요약2
Big data application architecture 요약2Seong-Bok Lee
 
What is Microsoft Azure used for?-Microsoft azure
What is Microsoft Azure used for?-Microsoft azure What is Microsoft Azure used for?-Microsoft azure
What is Microsoft Azure used for?-Microsoft azure Zabeel Institute
 
PowerDNS with MySQL
PowerDNS with MySQLPowerDNS with MySQL
PowerDNS with MySQLI Goo Lee
 
Mongo DB: Operational Big Data Database
Mongo DB: Operational Big Data DatabaseMongo DB: Operational Big Data Database
Mongo DB: Operational Big Data DatabaseXpand IT
 
DDN: Massively-Scalable Platforms and Solutions Engineered for the Big Data a...
DDN: Massively-Scalable Platforms and Solutions Engineered for the Big Data a...DDN: Massively-Scalable Platforms and Solutions Engineered for the Big Data a...
DDN: Massively-Scalable Platforms and Solutions Engineered for the Big Data a...inside-BigData.com
 

What's hot (20)

AWS re:Invent 2016: Strategic Planning for Long-Term Data Archiving with Amaz...
AWS re:Invent 2016: Strategic Planning for Long-Term Data Archiving with Amaz...AWS re:Invent 2016: Strategic Planning for Long-Term Data Archiving with Amaz...
AWS re:Invent 2016: Strategic Planning for Long-Term Data Archiving with Amaz...
 
第29回 SQL Server 勉強会 (JSSUG) - Azure Synapse Analytics 概要
第29回 SQL Server 勉強会 (JSSUG) - Azure Synapse Analytics 概要 第29回 SQL Server 勉強会 (JSSUG) - Azure Synapse Analytics 概要
第29回 SQL Server 勉強会 (JSSUG) - Azure Synapse Analytics 概要
 
Tadx - Présentation Conteneurisation
Tadx -  Présentation ConteneurisationTadx -  Présentation Conteneurisation
Tadx - Présentation Conteneurisation
 
Redis overview for Software Architecture Forum
Redis overview for Software Architecture ForumRedis overview for Software Architecture Forum
Redis overview for Software Architecture Forum
 
Oracle Database 12c : Multitenant
Oracle Database 12c : MultitenantOracle Database 12c : Multitenant
Oracle Database 12c : Multitenant
 
Les éléments d'indexation dans la DTD-EAD
Les éléments d'indexation dans la DTD-EADLes éléments d'indexation dans la DTD-EAD
Les éléments d'indexation dans la DTD-EAD
 
[B15] HiRDBのSQL実行プランはどのように決定しているのか?by Masaaki Narita
[B15] HiRDBのSQL実行プランはどのように決定しているのか?by Masaaki Narita[B15] HiRDBのSQL実行プランはどのように決定しているのか?by Masaaki Narita
[B15] HiRDBのSQL実行プランはどのように決定しているのか?by Masaaki Narita
 
Une introduction à HBase
Une introduction à HBaseUne introduction à HBase
Une introduction à HBase
 
Oracle E-Business Suite R12.2.6 on Database 12c: Install, Patch and Administer
Oracle E-Business Suite R12.2.6 on Database 12c: Install, Patch and AdministerOracle E-Business Suite R12.2.6 on Database 12c: Install, Patch and Administer
Oracle E-Business Suite R12.2.6 on Database 12c: Install, Patch and Administer
 
Mongodb vs mysql
Mongodb vs mysqlMongodb vs mysql
Mongodb vs mysql
 
MyDUMPER : Faster logical backups and restores
MyDUMPER : Faster logical backups and restores MyDUMPER : Faster logical backups and restores
MyDUMPER : Faster logical backups and restores
 
Redis vs Memcached
Redis vs MemcachedRedis vs Memcached
Redis vs Memcached
 
ぐるなびが活用するElastic Cloud
ぐるなびが活用するElastic Cloudぐるなびが活用するElastic Cloud
ぐるなびが活用するElastic Cloud
 
API Gatewayご紹介
API Gatewayご紹介API Gatewayご紹介
API Gatewayご紹介
 
Big data application architecture 요약2
Big data application architecture 요약2Big data application architecture 요약2
Big data application architecture 요약2
 
What is Microsoft Azure used for?-Microsoft azure
What is Microsoft Azure used for?-Microsoft azure What is Microsoft Azure used for?-Microsoft azure
What is Microsoft Azure used for?-Microsoft azure
 
PowerDNS with MySQL
PowerDNS with MySQLPowerDNS with MySQL
PowerDNS with MySQL
 
Mongo DB: Operational Big Data Database
Mongo DB: Operational Big Data DatabaseMongo DB: Operational Big Data Database
Mongo DB: Operational Big Data Database
 
Introduction à React
Introduction à ReactIntroduction à React
Introduction à React
 
DDN: Massively-Scalable Platforms and Solutions Engineered for the Big Data a...
DDN: Massively-Scalable Platforms and Solutions Engineered for the Big Data a...DDN: Massively-Scalable Platforms and Solutions Engineered for the Big Data a...
DDN: Massively-Scalable Platforms and Solutions Engineered for the Big Data a...
 

Viewers also liked

OrientDB - the 2nd generation of (Multi-Model) NoSQL
OrientDB - the 2nd generation  of  (Multi-Model) NoSQLOrientDB - the 2nd generation  of  (Multi-Model) NoSQL
OrientDB - the 2nd generation of (Multi-Model) NoSQLLuigi Dell'Aquila
 
OrientDB introduction - NoSQL
OrientDB introduction - NoSQLOrientDB introduction - NoSQL
OrientDB introduction - NoSQLLuca Garulli
 
OrientDB vs Neo4j - Comparison of query/speed/functionality
OrientDB vs Neo4j - Comparison of query/speed/functionalityOrientDB vs Neo4j - Comparison of query/speed/functionality
OrientDB vs Neo4j - Comparison of query/speed/functionalityCurtis Mosters
 
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
 
OrientDB - the 2nd generation of (Multi-Model) NoSQL - Codemotion Warsaw 2016
OrientDB - the 2nd generation of (Multi-Model) NoSQL - Codemotion Warsaw 2016OrientDB - the 2nd generation of (Multi-Model) NoSQL - Codemotion Warsaw 2016
OrientDB - the 2nd generation of (Multi-Model) NoSQL - Codemotion Warsaw 2016Luigi Dell'Aquila
 
OrientDB distributed architecture 1.1
OrientDB distributed architecture 1.1OrientDB distributed architecture 1.1
OrientDB distributed architecture 1.1Luca Garulli
 
Graph Databases & OrientDB
Graph Databases & OrientDBGraph Databases & OrientDB
Graph Databases & OrientDBArpit Poladia
 
Benchmarking graph databases on the problem of community detection
Benchmarking graph databases on the problem of community detectionBenchmarking graph databases on the problem of community detection
Benchmarking graph databases on the problem of community detectionSymeon Papadopoulos
 
Blueprintsについて
BlueprintsについてBlueprintsについて
BlueprintsについてTetsuro Nagae
 
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 vs Neo4j - and an introduction to NoSQL databases
OrientDB vs Neo4j - and an introduction to NoSQL databasesOrientDB vs Neo4j - and an introduction to NoSQL databases
OrientDB vs Neo4j - and an introduction to NoSQL databasesCurtis Mosters
 
OrientDB Distributed Architecture v2.0
OrientDB Distributed Architecture v2.0OrientDB Distributed Architecture v2.0
OrientDB Distributed Architecture v2.0Orient Technologies
 
Scaling GIS Data in Non-relational Data Stores
Scaling GIS Data in Non-relational Data StoresScaling GIS Data in Non-relational Data Stores
Scaling GIS Data in Non-relational Data StoresMike Malone
 
Bloor Research & DataStax: How graph databases solve previously unsolvable bu...
Bloor Research & DataStax: How graph databases solve previously unsolvable bu...Bloor Research & DataStax: How graph databases solve previously unsolvable bu...
Bloor Research & DataStax: How graph databases solve previously unsolvable bu...DataStax
 

Viewers also liked (15)

OrientDB - the 2nd generation of (Multi-Model) NoSQL
OrientDB - the 2nd generation  of  (Multi-Model) NoSQLOrientDB - the 2nd generation  of  (Multi-Model) NoSQL
OrientDB - the 2nd generation of (Multi-Model) NoSQL
 
OrientDB introduction - NoSQL
OrientDB introduction - NoSQLOrientDB introduction - NoSQL
OrientDB introduction - NoSQL
 
OrientDB vs Neo4j - Comparison of query/speed/functionality
OrientDB vs Neo4j - Comparison of query/speed/functionalityOrientDB vs Neo4j - Comparison of query/speed/functionality
OrientDB vs Neo4j - Comparison of query/speed/functionality
 
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
 
OrientDB - the 2nd generation of (Multi-Model) NoSQL - Codemotion Warsaw 2016
OrientDB - the 2nd generation of (Multi-Model) NoSQL - Codemotion Warsaw 2016OrientDB - the 2nd generation of (Multi-Model) NoSQL - Codemotion Warsaw 2016
OrientDB - the 2nd generation of (Multi-Model) NoSQL - Codemotion Warsaw 2016
 
OrientDB
OrientDBOrientDB
OrientDB
 
OrientDB distributed architecture 1.1
OrientDB distributed architecture 1.1OrientDB distributed architecture 1.1
OrientDB distributed architecture 1.1
 
Graph Databases & OrientDB
Graph Databases & OrientDBGraph Databases & OrientDB
Graph Databases & OrientDB
 
Benchmarking graph databases on the problem of community detection
Benchmarking graph databases on the problem of community detectionBenchmarking graph databases on the problem of community detection
Benchmarking graph databases on the problem of community detection
 
Blueprintsについて
BlueprintsについてBlueprintsについて
Blueprintsについて
 
OrientDB for real & Web App development
OrientDB for real & Web App developmentOrientDB for real & Web App development
OrientDB for real & Web App development
 
OrientDB vs Neo4j - and an introduction to NoSQL databases
OrientDB vs Neo4j - and an introduction to NoSQL databasesOrientDB vs Neo4j - and an introduction to NoSQL databases
OrientDB vs Neo4j - and an introduction to NoSQL databases
 
OrientDB Distributed Architecture v2.0
OrientDB Distributed Architecture v2.0OrientDB Distributed Architecture v2.0
OrientDB Distributed Architecture v2.0
 
Scaling GIS Data in Non-relational Data Stores
Scaling GIS Data in Non-relational Data StoresScaling GIS Data in Non-relational Data Stores
Scaling GIS Data in Non-relational Data Stores
 
Bloor Research & DataStax: How graph databases solve previously unsolvable bu...
Bloor Research & DataStax: How graph databases solve previously unsolvable bu...Bloor Research & DataStax: How graph databases solve previously unsolvable bu...
Bloor Research & DataStax: How graph databases solve previously unsolvable bu...
 

More from 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
 
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
 
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
 
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
 
Switching from Relational 2 Graph - CloudConf.it
Switching from Relational 2 Graph - CloudConf.itSwitching from Relational 2 Graph - CloudConf.it
Switching from Relational 2 Graph - CloudConf.itLuca Garulli
 
Switching from Relational to the Graph model v1.3
Switching from Relational to the Graph model v1.3Switching from Relational to the Graph model v1.3
Switching from Relational to the Graph model v1.3Luca 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
 
Internet Apps powered by NoSQL and JavaScript
Internet Apps powered by NoSQL and JavaScriptInternet Apps powered by NoSQL and JavaScript
Internet Apps powered by NoSQL and JavaScriptLuca 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
 
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
 
No sql matters_2012_keynote
No sql matters_2012_keynoteNo sql matters_2012_keynote
No sql matters_2012_keynoteLuca Garulli
 
Roma introduction and concepts
Roma introduction and conceptsRoma introduction and concepts
Roma introduction and conceptsLuca 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
 

More from Luca Garulli (17)

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
 
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
 
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
 
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 ...
 
Switching from Relational 2 Graph - CloudConf.it
Switching from Relational 2 Graph - CloudConf.itSwitching from Relational 2 Graph - CloudConf.it
Switching from Relational 2 Graph - CloudConf.it
 
Switching from Relational to the Graph model v1.3
Switching from Relational to the Graph model v1.3Switching from Relational to the Graph model v1.3
Switching from Relational to the Graph model v1.3
 
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
 
Internet Apps powered by NoSQL and JavaScript
Internet Apps powered by NoSQL and JavaScriptInternet Apps powered by NoSQL and JavaScript
Internet Apps powered by NoSQL and JavaScript
 
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
 
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
 
No sql matters_2012_keynote
No sql matters_2012_keynoteNo sql matters_2012_keynote
No sql matters_2012_keynote
 
Roma introduction and concepts
Roma introduction and conceptsRoma introduction and concepts
Roma introduction and concepts
 
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
 

Recently uploaded

Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
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
 
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
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 

Recently uploaded (20)

Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
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
 
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
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 

OrientDB document or graph? Select the right model (old presentation)

  • 1. Document rev 1.1 Select the right model „Document vs Graph, what is the answer?“ © Luca Garulli - 2012 Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 1
  • 2. OrientDB supports multiple models Document Graph Custom Graph* *available in 1.2 © Luca Garulli - 2012 Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 2
  • 3. What is the best choice for my domain? © Luca Garulli - 2012 Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 3
  • 4. Facts Graph Model has been built on top of the Document Model But why it is so fast? Because in OrientDB relationships are direct links, not relational JOINs © Luca Garulli - 2012 Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 4
  • 5. This is the reason why even using the Document model you can manage complex graphs of objects © Luca Garulli - 2012 Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 5
  • 6. Relationships © Luca Garulli - 2012 Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 6
  • 7. Graph Model Vertex & Edges I in Vertex Vertex A B out Connections using bidirectional Edges © Luca Garulli - 2012 Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 7
  • 8. Graph Model Vertex & Edges II in Vertex Vertex Edge A-B A B out Edges in OrientDB are records with own RecordID of class «OGraphEdge» or just «E» as alias. © Luca Garulli - 2012 Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 8
  • 9. Graph Model Vertex & Edges III out* in Vertex Vertex Edge A-B A B out * in To access to the ougoing vertices use «out.in» because: 1. Vertex A exits through «out» to go to the 2. Edge, and then 3. «in» to arrive to the Vertex B © Luca Garulli - 2012 Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 9
  • 10. Graph Model summary connect vertices using edges A vertex has "in" for the incoming relationships and "out" for the outgoing relationships are always bidirectional © Luca Garulli - 2012 Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 10
  • 11. Document Model oneway direct connections students * Professor Student Jay Steve Connections are directed without using Edges and are always monodirectional © Luca Garulli - 2012 Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 11
  • 12. Document Model express the cardinality students * Professor Student Jay Steve Students = N Using LINKSET type city 1 City Palo Alto City = 1 Using LINK type © Luca Garulli - 2012 Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 12
  • 13. Document Model express the cardinality students * Professor Student Jay Steve Use LINKSET or LINKMAP for unordered collection doesn’t accept duplicates, otherwise LINKLIST as ordered with duplicated © Luca Garulli - 2012 Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 13
  • 14. Document Model bidirectional connections students * Professor Student Jay Steve professors * To create bidirectional links create 2 relationships: 1. from Professor to Student 2. from Student to Professor © Luca Garulli - 2012 Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 14
  • 15. Document Model summary Connections are always as oneway, to have a bidirectional relationship create 2 connections Single cardinality: LINK Multiple cardinality: LINKSET and LINKMAP for unordered, no duplicates and LINKLIST: ordered allows duplicates © Luca Garulli - 2012 Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 15
  • 16. Graph Model vs Document Model © Luca Garulli - 2012 Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 16
  • 17. Graph Model PROS 1. Ability to use GREMLIN and full TinkerPop Blueprints stack 2. Connections are always bidirectional: leave open the ability to move in all the directions even is not planned at the beginning 3. Edges can have properties © Luca Garulli - 2012 Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 17
  • 18. Graph Model CONS 1. Edges are record themselves, so db is bigger: one record more per edge 2. Traversing between Vertices needs to load the Edge record too, so it‘s slower 3. All the outgoing relationships are inside the "out" collection: worst performance in case you have connections of different kind © Luca Garulli - 2012 Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 18
  • 19. Document Model PROS 1. Lighter than Graph Model, no need for a separate record to manage relationships 2. Faster on traversing because links are directing bypassing the Edge records 3. Finer grained cardinality setting also the relationship type © Luca Garulli - 2012 Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 19
  • 20. Document Model CONS 1. Cannot use the GREMLIN and full TinkerPop Blueprints stack 2. No native bidirectional connection, so the application has to manage the double connection 3. Edges cannot have properties © Luca Garulli - 2012 Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 20
  • 21. Suggestions What to use? Graph and Document models have PROS and CONS. Often it‘s hard to select the right one because there couldn‘t be a right one. The next use cases are very generics so don‘t take them as rule of the thumb © Luca Garulli - 2012 Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 21
  • 22. Suggestions (1) Social Applications Highly suggested the Graph Model because you‘re always ready to analyze the graph in any direction using advanced tools like GREMLIN language. Graph algorithm already developed through TinkerPop stack like Shortest Path, Ranking, etc. © Luca Garulli - 2012 Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 22
  • 23. Suggestions (2) CRM/Business Applications You could select both. Here the Document Model is a good candidate because relationships don‘t change so often and are mostly known at the beginning © Luca Garulli - 2012 Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 23
  • 24. Suggestions (3) Highest performance Since the Graph Model is heavier because requires more records and more traverse time, the suggested here is the Document Model © Luca Garulli - 2012 Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 24
  • 25. © Luca Garulli - 2012 Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 25
  • 26. NuvolaBase.com The first Graph Database on the Cloud always available few seconds to setup it use it from Web & Mobile apps © Luca Garulli - 2012 Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 26
  • 27. Luca Garulli Author of CEO at Document-Graph NoSQL Open Source project Ltd, London UK www.twitter.com/lgarulli © Luca Garulli - 2012 Licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License Page 27