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
@@ -342,6 +342,11 @@ RETURN n AS bandNodes
342
342
Added 4 nodes, Set 4 properties, Added 4 labels
343
343
|===
344
344
345
+
[NOTE]
346
+
`MERGE` queries using dynamic values may not be as performant as those using static values.
347
+
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.
348
+
For more information, see xref:clauses/merge.adoc#dynamic-merge-caveats[`MERGE` using dynamic node labels and relationship types -> Performance caveats].
349
+
345
350
=== Import compressed CSV files
346
351
347
352
`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
@@ -532,10 +532,6 @@ The expression must evaluate to a `STRING NOT NULL | LIST<STRING NOT NULL> NOT N
532
532
If you use a `LIST<STRING>` with more than one item in a relationship pattern with dynamic relationship types, no results will be returned.
533
533
This is because a relationship can only have exactly one type.
534
534
535
-
[NOTE]
536
-
Queries using dynamic values may not be as performant as those using static values.
537
-
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.
538
-
539
535
.Match labels dynamically
540
536
[source, cypher]
541
537
----
@@ -630,3 +626,11 @@ RETURN relationshipType, count(r) AS relationshipCount
630
626
2+d|Rows: 2
631
627
|===
632
628
629
+
[[dynamic-match-caveats]]
630
+
=== Performance caveats
631
+
632
+
`MATCH` queries using dynamic values may not be as performant as those using static values.
633
+
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.
634
+
635
+
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
@@ -703,10 +703,6 @@ The expression must evaluate to a `STRING NOT NULL | LIST<STRING NOT NULL> NOT N
703
703
Using a `LIST<STRING>` with more than one item when merging a relationship using dynamic relationship types will fail.
704
704
This is because a relationship can only have exactly one type.
705
705
706
-
[NOTE]
707
-
Queries using dynamic values may not be as performant as those using static values.
708
-
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.
709
-
710
706
.Parameters
711
707
[source, parameters]
712
708
----
@@ -730,7 +726,7 @@ RETURN greta.name AS name, labels(greta) AS labels, type(rel) AS relType, collec
730
726
// end::clauses_merge_dynamic_merge[]
731
727
732
728
.Result
733
-
[role="queryresult",options="footer",cols="3*<m"]
729
+
[role="queryresult",options="footer",cols="4*<m"]
734
730
|===
735
731
| name | labels | relType | movies
736
732
@@ -742,3 +738,45 @@ RETURN greta.name AS name, labels(greta) AS labels, type(rel) AS relType, collec
742
738
4+d|Rows: 1 +
743
739
|===
744
740
741
+
[[dynamic-merge-caveats]]
742
+
=== Performance caveats
743
+
744
+
`MERGE` queries that use dynamic values may not be as performant as those using static values.
745
+
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.
746
+
747
+
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.
748
+
749
+
To circumvent possible performance issues, place the dynamic labels or relationship types within `ON CREATE` or `ON MATCH` subclauses.
750
+
751
+
.Parameters
752
+
[source, parameters]
753
+
----
754
+
{
755
+
"onMatchLabels": ["Filmmaker", "AwardRecipient"],
756
+
"onCreateLabels": ["ScreenWriter", "AwardWinner"]
757
+
}
758
+
----
759
+
760
+
.Merge nodes using dynamic values in `ON CREATE` and `ON MATCH` subclauses
761
+
[source, cypher]
762
+
----
763
+
MERGE (n:Person {name: "Greta Gerwig"})
764
+
ON MATCH
765
+
SET n:$($onMatchLabels)
766
+
ON CREATE
767
+
SET n:$($onCreateLabels)
768
+
RETURN labels(n) AS gretaLabels
769
+
----
770
+
771
+
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