Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/2.3' into 3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
pontusmelke committed Nov 17, 2015
2 parents 9883390 + 200f53a commit 6032ca7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,8 @@ It will force Cypher to not use an index that could have been used, and instead

NOTE: You cannot use index hints if your query has a `START` clause.

You can also force Neo4j to produce plans which perform joins between query sub-graphs.

include::query-using-an-index-hint.asciidoc[]

include::query-using-multiple-index-hints.asciidoc[]

include::hinting-a-label-scan.asciidoc[]

include::hinting-a-join-on-a-single-node.asciidoc[]

include::hinting-a-join-on-multiple-nodes.asciidoc[]
Original file line number Diff line number Diff line change
Expand Up @@ -76,29 +76,4 @@ class UsingTest extends DocumentingTestBase {
assertions = (p) => assert(p.toList === List(Map("m" -> node("Stefan"))))
)
}

@Test def query_forcing_join() {
profileQuery(
title = "Hinting a join on a single node",
text = "To force the query planner to produce plans with joins in them, use +USING+ +JOIN+.",
queryText = "match (andres {name:'Andres'})-->(x)<--(emil {name: 'Emil'}) using join on x return x",
assertions = (p) => assert(p.toList === List(Map("x" -> node("Peter"))))
)
}

@Test def query_forcing_join_using_multiple_nodes() {
profileQuery(
title = "Hinting a join on multiple nodes",
text = "To force the query planner to produce plans with joins in them, use +USING+ +JOIN+.",
queryText = "match (andy {name:'Andres'})-[r1]->(x)<-[r2]-(y)-[r3]-(andy) using join on x, y return x, y",
assertions = (p) => {
assertThat(p.executionPlanDescription().toString, containsString("NodeHashJoin"))
assert(p.toSet === Set(
Map("x" -> node("Peter"), "y" -> node("Emil")),
Map("x" -> node("Peter"), "y" -> node("Jim")),
Map("x" -> node("Peter"), "y" -> node("Stefan"))
))
}
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class MatchTest extends RefcardTest with QueryStatisticsTestSupport {
case "related" =>
assertStats(result, nodesCreated = 0)
assert(result.toList.size === 1)
case "none" =>
}
}

Expand Down Expand Up @@ -98,5 +99,15 @@ RETURN r###
Optional pattern, ++NULL++s will be used for missing parts.
###assertion=none
MATCH (m:Person)
USING SCAN m:Person
WHERE m.name = 'Alice'
RETURN m###
Force the planner to use a label scan to solve the query (for manual performance tuning).
"""
}

0 comments on commit 6032ca7

Please sign in to comment.