redis graph
play

Redis Graph A graph database built on top of redis Whats Redis? - PowerPoint PPT Presentation

Redis Graph A graph database built on top of redis Whats Redis? Open source in-memory database Key => Data Structure server Key features: Fast, Flexible, Simple A Lego for your database Strings/Blobs/Bitmaps "I'm a Plain Text


  1. Redis Graph A graph database built on top of redis

  2. What’s Redis? Open source in-memory database Key => Data Structure server Key features: Fast, Flexible, Simple

  3. A Lego for your database Strings/Blobs/Bitmaps "I'm a Plain Text String!" Hash Tables (objects!) { A: “foo”, B: “bar”, C: “baz” } Linked Lists [ A → B → C → D → E ] Key Sets { A , B , C , D , E } Sorted Sets { A: 0.1, B: 0.3, C: 100, D: 1337 } Geo Sets { A: (51.5, 0.12), B: (32.1, 34.7) } HyperLogLog 00110101 11001110 10101010

  4. Node “Jerry Seinfeld”: { Jerry First_Name: “Jerry”, Seinfeld Age: 62 }

  5. Relations Visit Jerry Berlin

  6. Hexastore S P O Subject Predicate Object SPO SOP OPS 6 OSP PSO POS

  7. Hexastore Triplets SPO :Jerry:Visit:Berlin SOP: Jerry:Berlin:Visit OPS: Berlin:Visit:Jerry Visit OSP: Berlin:Jerry:Visit Jerry Berlin PSO: Visit:Jerry:Berlin S O P POS: Visit:Berlin:Jerry

  8. Hexastore Places Jerry been to? SPO :Jerry:Visit:* Who visited Berlin? OPS: Berlin:Visit:* Visit Jerry Berlin S O Who travels and to where? P PSO: Visit:*

  9. Query language Cypher* MATCH (Jerry:’Jerry Seinfeld’)-[friend]->(F)-[visit]->(country) WHERE (F.age >= Jerry.age AND country.continent = ‘Europe’) RETURN F.name, count(country.name) AS countriesVisited ORDER BY countriesVisited, F.age DESC LIMIT 2

  10. Query language Tokenizer - Lex Parser - Lemon, SQLite LALR(1) parser generator for C opencypher

  11. End to end MATCH (Jerry:’Jerry Seinfeld’)-[friend]->(F)-[visit]->(Country) WHERE F.age >= 50 AND Country.continent = “Europe” RETURN F.name, F.age, Country.name ORDER BY F.age DESC LIMIT 5

  12. End to end Query Lexer Parser AST

  13. End to end AST Root Match Where Return Order

  14. End to end MATCH (Jerry:"Jerry Seinfeld")-[friend]->(F)-[visit]->(Country) Alias: Alias: Jerry Alias: F Country ID: Jerry ID: ? friend visit ID: ? Seinfeld

  15. End to end Alias: Alias: Jerry Alias: F Country ID: Jerry ID: ? friend visit ID: ? Seinfeld SPO:Jerry Seinfeld:friend:* SPO:Jerry Seinfeld:friend:Cosmo Kramer SPO:Jerry Seinfeld:friend:George Costanza

  16. End to end Alias: F Alias: Alias: ID: Jerry Country Cosmo ID: Jerry friend visit ID: ? Kramer Seinfeld

  17. End to end WHERE F.age >= 50 AND Country.continent = “Europe” Filter tree AND continent age >= = 50 “Europe”

  18. End to end Cosmo Kramer: { AND Name: ‘Cosmo Kramer’, Age: 48 } continent Kramer = .age >= “Europe” 50

  19. End to end Cosmo Kramer: { AND Name: ‘Cosmo Kramer’, Age: 48 } Kramer continent .age >= = 50 “Europe” F

  20. End to end Cosmo Kramer: { AND Name: ‘Cosmo Kramer’, F Age: 48 } Kramer continent .age >= = 50 “Europe” F

  21. End to end Alias: Alias: Jerry Alias: F Country ID: Jerry ID: ? friend visit ID: ? Seinfeld SPO:Jerry Seinfeld:friend:* SPO:Jerry Seinfeld:friend:Cosmo Kramer SPO:Jerry Seinfeld:friend:George Costanza

  22. End to end Alias: Alias: F Alias: Jerry ID: Country ID: Jerry George friend visit ID: ? Seinfeld Costanza

  23. End to end AND George Costanza:{ Name: ‘George Costanza’, Age: 52 } continent George = .age >= “Europe” 50

  24. End to end AND George Costanza:{ Name: ‘George Costanza’, Age: 52 } George continent .age >= = 50 “Europe” T

  25. End to end AND George Costanza:{ T Name: ‘George Costanza’, Age: 52 } George continent .age >= = 50 “Europe” T T

  26. End to end Alias: Alias: F Alias: Jerry ID: Country ID: Jerry George friend visit ID: ? Seinfeld Costanza SPO:George Costanza:visit:* SPO:George Costanza:visit:Italy SPO:George Costanza:visit:Cuba

  27. End to end Alias: Alias: F Alias: Jerry ID: Country ID: Jerry George friend visit ID: Italy Seinfeld Costanza

  28. End to end AND George Costanza:{ T Name: ‘George Costanza’, Age: 52 } Italy George .continent Italy: { .age >= = 50 Continent: ‘Europe’, “Europe” T T Population: 1000, Name: ‘Italy’ }

  29. End to end TOP K heap [‘George Costanza’, 52, Italy] RETURN F.name, F.age, Country.name ORDER BY F.age DESC LIMIT 5

  30. Features Multi hop, multi entry point (A)-[R1]->(C)<-[R2]-(B) (Nicolas:’Nicolas Cage’)-[act]->(Movie)<-[act]-(Actor) Aggregations, Group bys RETURN F.gender, AVG(F.age) AS average_age Order bys, Distinct

  31. Benchmark 150K inserts per second 15K simple queries per second

  32. There’s still work to be done ● Single node query: MATCH (A) RETURN A ● OPTIONAL MATCH ● WITH, SKIP, UNION ● Curly brackets filters (john {name: ‘John’}) ● In place evaluations WHERE Me.age > F.age + X ● Shortest path between nodes (A)-[*]-(B) ● A number of aggregation functions: stdev, precentileCount

  33. Roadmap ● Hexastore sorted-set -> Trie ● Indexed entities ● Single node query ● Python lib

  34. Contribute/Contact https://github.com/swilly22/redis-module-graph @roilipman

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend