Slide 1

Slide 1 text

Graph databases Alberto Perdomo @albertoperdomo Baruco 2012

Slide 2

Slide 2 text

Graphs ● Structure consisting of nodes

Slide 3

Slide 3 text

Graphs ● Structure consisting of nodes ● Connected by edges

Slide 4

Slide 4 text

Graphs ● Structure consisting of nodes ● Connected by edges ● With properties

Slide 5

Slide 5 text

Graph databases ● Focus on relations ● Powerful queries based on deep relations ● Enhance your queries, like full-text search engines ● A new way to discover and interpret your data

Slide 6

Slide 6 text

Does it make a big difference? SHOW ME THE CODE!

Slide 7

Slide 7 text

People you might know (SQL) Source: http://techportal.inviqa.com/2009/09/07/graphs-in-the-database-sql-meets-social-networks/ SELECT a AS you, b AS mightknow, shared_connection, CASE WHEN (n1.feat1 = n2.feat1 AND n1.feat1 = n3.feat1) THEN 'feat1 in common' WHEN (n1.feat2 = n2.feat2 AND n1.feat2 = n3.feat2) THEN 'feat2 in common' ELSE 'nothing in common' END AS reason FROM ( WITH RECURSIVE transitive_closure(a, b, distance, path_string) AS ( SELECT a, b, 1 AS distance, a || '.' || b || '.' AS path_string, b AS direct_connection FROM edges2 WHERE a = 1 -- set the starting node UNION ALL SELECT tc.a, e.b, tc.distance + 1, tc.path_string || e.b || '.' AS path_string, tc.direct_connection FROM edges2 AS e JOIN transitive_closure AS tc ON e.a = tc.b WHERE tc.path_string NOT LIKE '%' || e.b || '.%' AND tc.distance < 2 ) SELECT a, b, direct_connection AS shared_connection FROM transitive_closure WHERE distance = 2 ) AS youmightknow LEFT JOIN nodes AS n1 ON youmightknow.a = n1.id LEFT JOIN nodes AS n2 ON youmightknow.b = n2.id LEFT JOIN nodes AS n3 ON youmightknow.shared_connection = n3.id WHERE (n1.feat1 = n2.feat1 AND n1.feat1 = n3.feat1) OR (n1.feat2 = n2.feat2 AND n1.feat2 = n3.feat2);

Slide 8

Slide 8 text

People you might know (gremlin) start = g.v(0) knows = start.out("knows").toList() + [start] start.out("knows").in("knows").filter { knows.indexOf(it) == -1 }

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

Code? Show me the performance!

Slide 11

Slide 11 text

● […] built this query in both MySQL and Neo4j with a database of 1,000,000 users and the results are striking. Execution Time is in seconds, for 1,000 users Friends of friends (performance) Source: http://www.neotechnology.com/2012/06/how-much-faster-is-a-graph-database-really/ Depth MySQL Neo4j Neo4j vs MySQL 2 0.016 secs 0.010 sec 60% faster 3 30 secs 0.168 sec 180x faster 4 25 minutes 1.359 sec 1,135x faster 5 Not finished in 1 hour 2.132 sec MySQL down

Slide 12

Slide 12 text

Enter GrapheneDB ● Graph database in the cloud ● Based on Neo4j ● Robust and mature ● Transactional ● REST API ● Powerful tools to manage & visualize your data ● Focus on documentation

Slide 13

Slide 13 text

Sign up for early access & take the survey grapheneDB.com

Slide 14

Slide 14 text

Thanks! grapheneDB.com