You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: modules/ROOT/pages/clauses/match.adoc
+19-3Lines changed: 19 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -639,10 +639,26 @@ RETURN relationshipType, count(r) AS relationshipCount
639
639
[[dynamic-match-caveats]]
640
640
=== Performance caveats
641
641
642
-
`MATCH` queries using dynamic values may not be as performant as those using static values.
643
-
This is because the xref:planning-and-tuning/execution-plans.adoc[Cypher planner] uses statically available information when planning queries to determine whether to use an xref:indexes/search-performance-indexes/index.adoc[index] or not, and this is not possible when using dynamic values.
642
+
`MATCH` queries that use dynamic values may not perform as well as those with static values.
643
+
Neo4j is actively working to improve the performance of these queries.
644
+
The table below outlines performance caveats for specific Neo4j versions.
644
645
645
-
As a result, `MATCH` queries using dynamic values cannot leverage xref:planning-and-tuning/operators/operators-detail.adoc#leaf-operators[index scans or seeks] and must instead use the xref:planning-and-tuning/operators/operators-detail.adoc#query-plan-all-nodes-scan[`AllNodesScan`] operator, which reads all nodes from the node store and is therefore more costly.
646
+
.Neo4j versions and performance caveats
647
+
[%header,cols="a,5a"]
648
+
|===
649
+
| Neo4j versions | Performance caveat
650
+
651
+
| 5.26 -- 2025.07
652
+
| The xref:planning-and-tuning/execution-plans.adoc[Cypher planner] is not able to leverage xref:indexes/search-performance-indexes/index.adoc[indexes] with xref:planning-and-tuning/operators/operators-detail.adoc#leaf-operators[index scans or seeks] and must instead utilize the xref:planning-and-tuning/operators/operators-detail.adoc#query-plan-all-nodes-scan[`AllNodesScan`] operator, which reads all nodes from the node store and is therefore more costly.
653
+
654
+
| 2025.08 -- current
655
+
| The Cypher planner is able to leverage xref:indexes/search-performance-indexes/using-indexes.adoc#token-lookup-indexes[token lookup indexes] when matching node labels and relationship types dynamically.
656
+
This is enabled by the introduction of three new query plan operators:
657
+
xref:planning-and-tuning/operators/operators-detail.adoc#query-plan-dynamic-node-label-lookup[`DynamicNodeLabelLookup`], xref:planning-and-tuning/operators/operators-detail.adoc#query-plan-dynamic-directed-relationship-type-lookup[`DynamicDirectedRelationshipTypeLookup`], and xref:planning-and-tuning/operators/operators-detail.adoc#query-plan-dynamic-undirected-relationship-type-lookup[`DynamicUndirectedRelationshipTypeLookup`].
658
+
It is not, however, able to use indexes on property values.
659
+
For example, `MATCH (n:$(Label) {foo: bar})` will not use any indexes on `n.foo` but can use a `DynamicNodeLabelLookup` on `$(label)`.
Copy file name to clipboardExpand all lines: modules/ROOT/pages/clauses/merge.adoc
+15-34Lines changed: 15 additions & 34 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -740,42 +740,23 @@ RETURN greta.name AS name, labels(greta) AS labels, type(rel) AS relType, collec
740
740
[[dynamic-merge-caveats]]
741
741
=== Performance caveats
742
742
743
-
`MERGE` queries that use dynamic values may not be as performant as those using static values.
744
-
This is because the xref:planning-and-tuning/execution-plans.adoc[Cypher planner] uses statically available information when planning queries to determine whether to use an xref:indexes/search-performance-indexes/index.adoc[index] or not, and this is not possible when using dynamic values.
743
+
`MERGE` queries that use dynamic values may not perform as well as those with static values.
744
+
Neo4j is actively working to improve the performance of these queries.
745
+
The table below outlines performance caveats for specific Neo4j versions.
745
746
746
-
As a result, `MERGE` queries with dynamic values cannot leverage xref:planning-and-tuning/operators/operators-detail.adoc#leaf-operators[index scans or seeks] and must instead use the xref:planning-and-tuning/operators/operators-detail.adoc#query-plan-all-nodes-scan[`AllNodesScan`] operator, which reads all nodes from the node store and is therefore more costly.
747
-
748
-
To circumvent possible performance issues, place the dynamic labels or relationship types within `ON CREATE` or `ON MATCH` subclauses.
749
-
750
-
.Parameters
751
-
[source, parameters]
752
-
----
753
-
{
754
-
"onMatchLabels": ["Filmmaker", "AwardRecipient"],
755
-
"onCreateLabels": ["ScreenWriter", "AwardWinner"]
756
-
}
757
-
----
758
-
759
-
.Merge nodes using dynamic values in `ON CREATE` and `ON MATCH` subclauses
760
-
[source, cypher]
761
-
----
762
-
MERGE (n:Person {name: "Greta Gerwig"})
763
-
ON MATCH
764
-
SET n:$($onMatchLabels)
765
-
ON CREATE
766
-
SET n:$($onCreateLabels)
767
-
RETURN labels(n) AS gretaLabels
768
-
----
769
-
770
-
Because a `Person` node with the `name` "Greta Gerwig" already exists, this query will only `SET` the dynamic labels added to the `ON MATCH` subclause.
| The xref:planning-and-tuning/execution-plans.adoc[Cypher planner] is not able to leverage xref:indexes/search-performance-indexes/index.adoc[indexes] with xref:planning-and-tuning/operators/operators-detail.adoc#leaf-operators[index scans or seeks] and must instead utilize the xref:planning-and-tuning/operators/operators-detail.adoc#query-plan-all-nodes-scan[`AllNodesScan`] operator, which reads all nodes from the node store and is therefore more costly.
778
754
779
-
1+d|Rows: 1
780
-
|===
755
+
| 2025.08 -- current
756
+
| The Cypher planner is able to leverage xref:indexes/search-performance-indexes/using-indexes.adoc#token-lookup-indexes[token lookup indexes] when matching node labels and relationship types dynamically.
757
+
This is enabled by the introduction of three new query plan operators:
758
+
xref:planning-and-tuning/operators/operators-detail.adoc#query-plan-dynamic-node-label-lookup[`DynamicNodeLabelLookup`], xref:planning-and-tuning/operators/operators-detail.adoc#query-plan-dynamic-directed-relationship-type-lookup[`DynamicDirectedRelationshipTypeLookup`], and xref:planning-and-tuning/operators/operators-detail.adoc#query-plan-dynamic-undirected-relationship-type-lookup[`DynamicUndirectedRelationshipTypeLookup`].
759
+
It is not, however, able to use indexes on property values.
760
+
For example, `MERGE (n:$(Label) {foo: bar})` will not use any indexes on `n.foo` but can use a `DynamicNodeLabelLookup` on `$(label)`.
| Cypher can now leverage xref:indexes/search-performance-indexes/using-indexes.adoc#token-lookup-indexes[token lookup indexes] when planning queries with xref:clauses/match.adoc#dynamic-match[dynamic labels and relationship types].
47
+
This is enabled by the introduction of three new query plan operators: xref:planning-and-tuning/operators/operators-detail.adoc#query-plan-dynamic-node-label-lookup[`DynamicNodeLabelLookup`], xref:planning-and-tuning/operators/operators-detail.adoc#query-plan-dynamic-directed-relationship-type-lookup[`DynamicDirectedRelationshipTypeLookup`], and xref:planning-and-tuning/operators/operators-detail.adoc#query-plan-dynamic-undirected-relationship-type-lookup[`DynamicUndirectedRelationshipTypeLookup`].
48
+
|===
49
+
28
50
=== New in Cypher 25
29
51
30
52
[cols="2", options="header"]
@@ -45,7 +67,6 @@ ORDER BY head(n).x, size(n)
45
67
46
68
| New xref:functions/predicate.adoc#functions-allreduce[`allReduce()`] function.
47
69
It enables the stepwise evaluation of a value accumulated over a path, allowing for early pruning of paths that do not satisfy a given predicate, and is optimized for path expansions.
Copy file name to clipboardExpand all lines: modules/ROOT/pages/planning-and-tuning/operators/operators-detail.adoc
+136Lines changed: 136 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2576,6 +2576,142 @@ Total database accesses: 106
2576
2576
2577
2577
======
2578
2578
2579
+
[role=label--new-2025.08]
2580
+
[[query-plan-dynamic-node-label-lookup]]
2581
+
=== Dynamic Node Label Lookup
2582
+
2583
+
Allows Cypher to use xref:indexes/search-performance-indexes/using-indexes.adoc#token-lookup-indexes[token lookup indexes] when planning queries using xref:clauses/match.adoc#dynamic-match[dynamic node labels].
Allows Cypher to use xref:indexes/search-performance-indexes/using-indexes.adoc#token-lookup-indexes[token lookup indexes] when planning queries using xref:clauses/match.adoc#dynamic-match[dynamic relationship types] in directed relationship patterns.
Allows Cypher to use xref:indexes/search-performance-indexes/using-indexes.adoc#token-lookup-indexes[token lookup indexes] when planning queries using dynamic relationship types in undirected relationship patterns.
0 commit comments