opencypher org opencypher org opencypher googlegroups com
play

opencypher.org opencypher.org | opencypher@googlegroups.com - PowerPoint PPT Presentation

opencypher.org opencypher.org | opencypher@googlegroups.com opencypher.org opencypher.org | opencypher@googlegroups.com START john=node:Person(name="John") MATCH john-[:KNOWS]-friend-[:KNOWS]-foaf RETURN


  1. opencypher.org opencypher.org | opencypher@googlegroups.com

  2. • • • • • • opencypher.org opencypher.org | opencypher@googlegroups.com

  3. START john=node:Person(name="John") MATCH john-[:KNOWS]-friend-[:KNOWS]-foaf RETURN foaf opencypher.org opencypher.org | opencypher@googlegroups.com

  4. START john=node:Person(name="John") MATCH (john)-[:KNOWS]-(friend)-[:KNOWS]-(foaf) WHERE NOT (john)-[:KNOWS]-(foaf) AND NOT (john)-[:RECOMMENDATION]->(foaf) CREATE (john)-[:RECOMMENDATION]->(foaf) RETURN foaf opencypher.org opencypher.org | opencypher@googlegroups.com

  5. MATCH (john:Person{name:"John"}), (john)-[:KNOWS]-(friend)-[:KNOWS]-(foaf) WHERE NOT (john)-[:KNOWS]-(foaf) MERGE (john)-[:RECOMMENDATION]->(foaf) opencypher.org opencypher.org | opencypher@googlegroups.com

  6. Query => AST => AST’ AST’ => Query Graph => Logical Plan L Plan => Instruction => CodeGen => JVM Class opencypher.org opencypher.org | opencypher@googlegroups.com

  7. (query:String)-[:PARSED_TO]->(:AST {pos: $pos}) opencypher.org opencypher.org | opencypher@googlegroups.com

  8. SemanticState => SemanticState opencypher.org opencypher.org | opencypher@googlegroups.com

  9. The AST is optimised and canonicalized Custom functional rewriting code opencypher.org opencypher.org | opencypher@googlegroups.com

  10. opencypher.org opencypher.org | opencypher@googlegroups.com

  11. Output: Logical Plans similar to relational query plans Expand/VarExpand are the main differences to normal relational algebra opencypher.org opencypher.org | opencypher@googlegroups.com

  12. Similar to the System R - Dynamic Programming Quick Reminder, the Selinger Algorithm: 1. Enumerate all access paths for single relation 2. Consider all ways to join two relations 3. Consider all ways to join three relations, etc [Access path selection in a relational database management system, Selinger et al] opencypher.org opencypher.org | opencypher@googlegroups.com

  13. Neo4j Cost Planner 1. Enumerate all access paths for pattern nodes 2. Consider all ways to expand pattern relationships 3. Consider all ways to solve two pattern relationships, either by expand or join, etc for three, four patter relationships [Iterative dynamic programming: a new class of query optimization algorithms, Kossman, Stocker] opencypher.org opencypher.org | opencypher@googlegroups.com

  14. Pattern: (a)-[r1]->(b)<-[r2]-(c) e -[r2]-> (c) ⋈ Solutions: e (b)<-[r2]- e -[r1]-> (b) e -[r1]-> (b) |a| |a| |c| opencypher.org opencypher.org | opencypher@googlegroups.com

  15. opencypher.org opencypher.org | opencypher@googlegroups.com

  16. opencypher.org opencypher.org | opencypher@googlegroups.com

  17. IDPSolver SingleComponentPlanner CardinalityCostModel opencypher.org opencypher.org | opencypher@googlegroups.com

  18. • • accept(...) L Plan => Instruction => CodeGen => JVM Class [Efficiently Compiling Efficient Query Plans for Modern Hardware, Thomas Neumann] opencypher.org opencypher.org | opencypher@googlegroups.com

  19. Instruction Cypher While(Variable("v1") -> ScanAllNodes()){ Selection( MATCH (n) If("v1=100", WHERE n.x = 100 AcceptVisitor( Map("n"-> NodeProjection(Variable("v1")))))) RETURN n } ) opencypher.org opencypher.org | opencypher@googlegroups.com

  20. AllNodesScan Filter Project opencypher.org opencypher.org | opencypher@googlegroups.com

  21. AllNodesScan Filter Project opencypher.org opencypher.org | opencypher@googlegroups.com

  22. opencypher.org opencypher.org | opencypher@googlegroups.com

Recommend


More recommend