pg conf - implementing graph database based-on postgresql
Post on 14-Apr-2017
399 Views
Preview:
TRANSCRIPT
Images from http://www.slideshare.net/debanjanmahata/an-introduction-to-nosql-graph-databases-and-neo4j
•
•
Relational Database Graph Database
Entity Row Node (Vertex)
Relationship Row Relationship (Edge)
Make two nodesCREATE (:person {id: 1, name: “Kisung Kim”, birthday: 1980-01-05});CREATE (:company {id: 1, name: “Bitnine Global”});
Make a relationship between the two nodesMATCH (p:person {id: 1}), (c:company {id:1})CREATE (p)-[:workFor {title: “CTO”, since: 2014}]->(c);
Kisung Kim Bitnine GlobalworkFor
QueryingMATCH (p:person {name: “Kisung Kim”})-[:workFor]->(c:company)RETURN (p), (c)
No Table Definitions and No Joins
Query with variable length relationshipsMATCH (p:person {name: “Kisung Kim”})-[:knows*..3]->(f:person)RETURN (f)
Kisung Kim ?workFor
Kisung Kim ?knows
?knows
?knows
Solution Company Latest Version Features
Neo Technology 3.1Most famous graph database, Cypher
O(1) access using fixed-size array
Datastax -Distributed graph system based on
Cassandra
Titan
•–
•
•
GraphVertex Edge
Vertex ID Properties Edge ID PropertiesStart Vertex ID End Vertex ID
B-treeVertex ID
B-tree(Start, End)
B-tree(End, Start)
•
Edge
Edge ID PropertiesStart Vertex ID End Vertex ID
B-tree(Start, End)
B-tree(End, Start)
Edge ID Properties
B-tree orHash index
(Vertex ID)
(Adjacent Vertex ID, Edge ID)
B-tree (Edge ID)
•
•
•
Vertex ID Properties
ag_vertex
Vertex ID Properties
PersonVertex ID Properties
Message
Vertex ID Properties
Comment
Vertex ID Properties
Post
• AgensGraph v0.9 (https://github.com/bitnine-oss/agens-graph or http://bitnine.net/downloads/)
– Graph data model and DDL on PostgreSQL 9.6
– Cypher query processing (70% of OpenCypher spec.)
– Integrated query processing (Cypher + SQL)
– Client library (JDBC, ODBC, Python)
– Monitoring and development using Tadpole DB-hub
•
•
•–
Person
Country:X
Person:knows*1..2
Message
Given a start Person, find Persons that are their friends and friends of friends that have madeMessages in both of the given Countries, X and Y, within a given period. Only Persons that areforeign to Countries X and Y are considered, that is Persons whose Location is not Country X orCountry Y.
top related