From 9c74c283eaa2103a4967a2620cd1ac3e190925ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20Pryce-=C3=85klundh?= <112686610+JPryce-Aklundh@users.noreply.github.com> Date: Thu, 19 Dec 2024 13:32:31 +0100 Subject: [PATCH 1/2] initial --- modules/ROOT/pages/clauses/load-csv.adoc | 5 +++ modules/ROOT/pages/clauses/match.adoc | 12 ++++-- modules/ROOT/pages/clauses/merge.adoc | 48 +++++++++++++++++++++--- 3 files changed, 56 insertions(+), 9 deletions(-) diff --git a/modules/ROOT/pages/clauses/load-csv.adoc b/modules/ROOT/pages/clauses/load-csv.adoc index 6a8986945..08aee70b4 100644 --- a/modules/ROOT/pages/clauses/load-csv.adoc +++ b/modules/ROOT/pages/clauses/load-csv.adoc @@ -342,6 +342,11 @@ RETURN n AS bandNodes Added 4 nodes, Set 4 properties, Added 4 labels |=== +[NOTE] +`MERGE` queries using dynamic values may not be as performant as those using static values. +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. +For more information, see xref:clauses/merge.adoc#dynamic-merge-caveats[`MERGE` using dynamic node labels and relationship types -> Performance caveats] + === Import compressed CSV files `LOAD CSV` can read local CSV files compressed with ZIP or gzip. diff --git a/modules/ROOT/pages/clauses/match.adoc b/modules/ROOT/pages/clauses/match.adoc index bc81ff811..90729102d 100644 --- a/modules/ROOT/pages/clauses/match.adoc +++ b/modules/ROOT/pages/clauses/match.adoc @@ -532,10 +532,6 @@ The expression must evaluate to a `STRING NOT NULL | LIST NOT N If you use a `LIST` with more than one item in a relationship pattern with dynamic relationship types, no results will be returned. This is because a relationship can only have exactly one type. -[NOTE] -Queries using dynamic values may not be as performant as those using static values. -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. - .Match labels dynamically [source, cypher] ---- @@ -630,3 +626,11 @@ RETURN relationshipType, count(r) AS relationshipCount 2+d|Rows: 2 |=== +[[dynamic-match-caveats]] +=== Performance caveats + +`MATCH` queries using dynamic values may not be as performant as those using static values. +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. + +As a result, `MATCH` queries using dynamic values cannot make use of any 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. + diff --git a/modules/ROOT/pages/clauses/merge.adoc b/modules/ROOT/pages/clauses/merge.adoc index 2f56bc1d6..1110bd445 100644 --- a/modules/ROOT/pages/clauses/merge.adoc +++ b/modules/ROOT/pages/clauses/merge.adoc @@ -703,10 +703,6 @@ The expression must evaluate to a `STRING NOT NULL | LIST NOT N Using a `LIST` with more than one item when merging a relationship using dynamic relationship types will fail. This is because a relationship can only have exactly one type. -[NOTE] -Queries using dynamic values may not be as performant as those using static values. -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. - .Parameters [source, parameters] ---- @@ -730,7 +726,7 @@ RETURN greta.name AS name, labels(greta) AS labels, type(rel) AS relType, collec // end::clauses_merge_dynamic_merge[] .Result -[role="queryresult",options="footer",cols="3* Date: Thu, 19 Dec 2024 15:11:45 +0100 Subject: [PATCH 2/2] tiny correction --- modules/ROOT/pages/clauses/load-csv.adoc | 2 +- modules/ROOT/pages/clauses/match.adoc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/ROOT/pages/clauses/load-csv.adoc b/modules/ROOT/pages/clauses/load-csv.adoc index 08aee70b4..ebf126222 100644 --- a/modules/ROOT/pages/clauses/load-csv.adoc +++ b/modules/ROOT/pages/clauses/load-csv.adoc @@ -345,7 +345,7 @@ Added 4 nodes, Set 4 properties, Added 4 labels [NOTE] `MERGE` queries using dynamic values may not be as performant as those using static values. 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. -For more information, see xref:clauses/merge.adoc#dynamic-merge-caveats[`MERGE` using dynamic node labels and relationship types -> Performance caveats] +For more information, see xref:clauses/merge.adoc#dynamic-merge-caveats[`MERGE` using dynamic node labels and relationship types -> Performance caveats]. === Import compressed CSV files diff --git a/modules/ROOT/pages/clauses/match.adoc b/modules/ROOT/pages/clauses/match.adoc index 90729102d..dbf136f4a 100644 --- a/modules/ROOT/pages/clauses/match.adoc +++ b/modules/ROOT/pages/clauses/match.adoc @@ -632,5 +632,5 @@ RETURN relationshipType, count(r) AS relationshipCount `MATCH` queries using dynamic values may not be as performant as those using static values. 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. -As a result, `MATCH` queries using dynamic values cannot make use of any 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. +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.