- pencypher.org
- pencypher.org | opencypher@googlegroups.com
opencypher.org opencypher.org | opencypher@googlegroups.com - - PowerPoint PPT Presentation
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
- pencypher.org
- pencypher.org | opencypher@googlegroups.com
- pencypher.org
- pencypher.org | opencypher@googlegroups.com
START john=node:Person(name="John") MATCH john-[:KNOWS]-friend-[:KNOWS]-foaf RETURN foaf
- pencypher.org
- pencypher.org | opencypher@googlegroups.com
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
- pencypher.org
- pencypher.org | opencypher@googlegroups.com
MATCH (john:Person{name:"John"}), (john)-[:KNOWS]-(friend)-[:KNOWS]-(foaf) WHERE NOT (john)-[:KNOWS]-(foaf) MERGE (john)-[:RECOMMENDATION]->(foaf)
- pencypher.org
- pencypher.org | opencypher@googlegroups.com
Query => AST => AST’ AST’ => Query Graph => Logical Plan L Plan => Instruction => CodeGen => JVM Class
- pencypher.org
- pencypher.org | opencypher@googlegroups.com
(query:String)-[:PARSED_TO]->(:AST {pos: $pos})
- pencypher.org
- pencypher.org | opencypher@googlegroups.com
SemanticState => SemanticState
- pencypher.org
- pencypher.org | opencypher@googlegroups.com
The AST is optimised and canonicalized Custom functional rewriting code
- pencypher.org
- pencypher.org | opencypher@googlegroups.com
- pencypher.org
- pencypher.org | opencypher@googlegroups.com
Output: Logical Plans similar to relational query plans Expand/VarExpand are the main differences to normal relational algebra
- pencypher.org
- pencypher.org | opencypher@googlegroups.com
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]
- pencypher.org
- pencypher.org | opencypher@googlegroups.com
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]
- pencypher.org
- pencypher.org | opencypher@googlegroups.com
Pattern: (a)-[r1]->(b)<-[r2]-(c) |a| e-[r1]-> (b) e-[r2]-> (c) ⋈ |a| |c| e-[r1]-> (b) e(b)<-[r2]- Solutions:
- pencypher.org
- pencypher.org | opencypher@googlegroups.com
- pencypher.org
- pencypher.org | opencypher@googlegroups.com
- pencypher.org
- pencypher.org | opencypher@googlegroups.com
IDPSolver SingleComponentPlanner CardinalityCostModel
- pencypher.org
- pencypher.org | opencypher@googlegroups.com
- accept(...)
L Plan => Instruction => CodeGen => JVM Class
[Efficiently Compiling Efficient Query Plans for Modern Hardware, Thomas Neumann]
- pencypher.org
- pencypher.org | opencypher@googlegroups.com
Cypher MATCH (n) WHERE n.x = 100 RETURN n Instruction
While(Variable("v1") -> ScanAllNodes()){ Selection( If("v1=100", AcceptVisitor( Map("n"-> NodeProjection(Variable("v1")))))) } )
- pencypher.org
- pencypher.org | opencypher@googlegroups.com
AllNodesScan Filter Project
- pencypher.org
- pencypher.org | opencypher@googlegroups.com
AllNodesScan Filter Project
- pencypher.org
- pencypher.org | opencypher@googlegroups.com