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/load-csv.adoc
+5Lines changed: 5 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -339,6 +339,11 @@ RETURN n AS bandNodes
339
339
Added 4 nodes, Set 4 properties, Added 4 labels
340
340
|===
341
341
342
+
[NOTE]
343
+
`MERGE` queries using dynamic values may not be as performant as those using static values.
344
+
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/overview.adoc[index] or not, and this is not possible when using dynamic values.
345
+
For more information, see xref:clauses/merge.adoc#dynamic-merge-caveats[`MERGE` using dynamic node labels and relationship types -> Performance caveats].
346
+
342
347
=== Import compressed CSV files
343
348
344
349
`LOAD CSV` can read local CSV files compressed with ZIP or gzip.
Copy file name to clipboardExpand all lines: modules/ROOT/pages/clauses/match.adoc
+8-4Lines changed: 8 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -522,10 +522,6 @@ The expression must evaluate to a `STRING NOT NULL | LIST<STRING NOT NULL> NOT N
522
522
If you use a `LIST<STRING>` with more than one item in a relationship pattern with dynamic relationship types, no results will be returned.
523
523
This is because a relationship can only have exactly one type.
524
524
525
-
[NOTE]
526
-
Queries using dynamic values may not be as performant as those using static values.
527
-
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/overview.adoc[index] or not, and this is not possible when using dynamic values.
528
-
529
525
.Match labels dynamically
530
526
[source, cypher]
531
527
----
@@ -614,3 +610,11 @@ RETURN relationshipType, count(r) AS relationshipCount
614
610
2+d|Rows: 2
615
611
|===
616
612
613
+
[[dynamic-match-caveats]]
614
+
=== Performance caveats
615
+
616
+
`MATCH` queries using dynamic values may not be as performant as those using static values.
617
+
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/overview.adoc[index] or not, and this is not possible when using dynamic values.
618
+
619
+
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.
Copy file name to clipboardExpand all lines: modules/ROOT/pages/clauses/merge.adoc
+43-5Lines changed: 43 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -702,10 +702,6 @@ The expression must evaluate to a `STRING NOT NULL | LIST<STRING NOT NULL> NOT N
702
702
Using a `LIST<STRING>` with more than one item when merging a relationship using dynamic relationship types will fail.
703
703
This is because a relationship can only have exactly one type.
704
704
705
-
[NOTE]
706
-
Queries using dynamic values may not be as performant as those using static values.
707
-
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/overview.adoc[index] or not, and this is not possible when using dynamic values.
708
-
709
705
.Parameters
710
706
[source, parameters]
711
707
----
@@ -727,7 +723,7 @@ RETURN greta.name AS name, labels(greta) AS labels, type(rel) AS relType, collec
727
723
----
728
724
729
725
.Result
730
-
[role="queryresult",options="footer",cols="3*<m"]
726
+
[role="queryresult",options="footer",cols="4*<m"]
731
727
|===
732
728
| name | labels | relType | movies
733
729
@@ -739,3 +735,45 @@ RETURN greta.name AS name, labels(greta) AS labels, type(rel) AS relType, collec
739
735
4+d|Rows: 1 +
740
736
|===
741
737
738
+
[[dynamic-merge-caveats]]
739
+
=== Performance caveats
740
+
741
+
`MERGE` queries that use dynamic values may not be as performant as those using static values.
742
+
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/overview.adoc[index] or not, and this is not possible when using dynamic values.
743
+
744
+
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.
745
+
746
+
To circumvent possible performance issues, place the dynamic labels or relationship types within `ON CREATE` or `ON MATCH` subclauses.
747
+
748
+
.Parameters
749
+
[source, parameters]
750
+
----
751
+
{
752
+
"onMatchLabels": ["Filmmaker", "AwardRecipient"],
753
+
"onCreateLabels": ["ScreenWriter", "AwardWinner"]
754
+
}
755
+
----
756
+
757
+
.Merge nodes using dynamic values in `ON CREATE` and `ON MATCH` subclauses
758
+
[source, cypher]
759
+
----
760
+
MERGE (n:Person {name: "Greta Gerwig"})
761
+
ON MATCH
762
+
SET n:$($onMatchLabels)
763
+
ON CREATE
764
+
SET n:$($onCreateLabels)
765
+
RETURN labels(n) AS gretaLabels
766
+
----
767
+
768
+
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.
0 commit comments