Skip to content

Commit 8c5585b

Browse files
New Cypher runtimes chapter (#688)
To be released alongside Parallel runtime. Includes changes from the following PRs: - #667 - #676 - #712 - #732
1 parent ef8e1ac commit 8c5585b

32 files changed

+1832
-1075
lines changed

modules/ROOT/content-nav.adoc

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -84,19 +84,17 @@
8484
** xref:constraints/syntax.adoc[]
8585
** xref:constraints/examples.adoc[]
8686
87-
* xref:query-tuning/index.adoc[]
88-
** xref:query-tuning/query-options.adoc[]
89-
** xref:query-tuning/query-profile.adoc[]
90-
** xref:query-tuning/indexes.adoc[]
91-
** xref:query-tuning/basic-example.adoc[]
92-
** xref:query-tuning/advanced-example.adoc[]
93-
** xref:query-tuning/using.adoc[]
94-
95-
* xref:execution-plans/index.adoc[]
96-
** xref:execution-plans/db-hits.adoc[]
97-
** xref:execution-plans/operator-summary.adoc[]
98-
** xref:execution-plans/operators.adoc[]
99-
** xref:execution-plans/shortestpath-planning.adoc[]
87+
* xref:planning-and-tuning/index.adoc[]
88+
** xref:planning-and-tuning/execution-plans.adoc[]
89+
** xref:planning-and-tuning/operators/index.adoc[]
90+
*** xref:planning-and-tuning/operators/operators-detail.adoc[]
91+
** xref:planning-and-tuning/runtimes/index.adoc[]
92+
*** xref:planning-and-tuning/runtimes/concepts.adoc[Concepts]
93+
*** xref:planning-and-tuning/runtimes/reference.adoc[]
94+
** xref:planning-and-tuning/query-tuning/index.adoc[]
95+
*** xref:planning-and-tuning/query-tuning/indexes.adoc[]
96+
*** xref:planning-and-tuning/query-tuning/using.adoc[]
97+
*** xref:planning-and-tuning/query-tuning/query-options.adoc[]
10098
10199
* xref:query-caches/index.adoc[]
102100
** xref:query-caches/unified-query-caches.adoc[]
@@ -116,3 +114,4 @@
116114
117115
* Appendix
118116
** xref:styleguide.adoc[]
117+
** xref:appendix/tutorials/index.adoc[]

modules/ROOT/images/runtimes_cypher_lifecycle.svg

Lines changed: 41 additions & 0 deletions
Loading

modules/ROOT/images/runtimes_execution_graph1.svg

Lines changed: 9 additions & 0 deletions
Loading

modules/ROOT/images/runtimes_execution_graph2.svg

Lines changed: 9 additions & 0 deletions
Loading

modules/ROOT/pages/query-tuning/advanced-example.adoc renamed to modules/ROOT/pages/appendix/tutorials/advanced-query-tuning.adoc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
:description: Example of some more subtle optimizations based on native index capabilities.
2-
3-
42
[[advanced-query-tuning-example]]
53
= Advanced query tuning example
64

75
This page describes advanced query optimizations based on native index capabilities.
86

97
One of the most important and useful ways of optimizing Cypher queries involves creating appropriate indexes.
10-
This is described in more detail in xref::indexes-for-search-performance.adoc[], and demonstrated in xref::query-tuning/basic-example.adoc[].
8+
This is described in more detail in xref::indexes-for-search-performance.adoc[], and demonstrated in xref::appendix/tutorials/basic-query-tuning.adoc[].
119
In summary, an index will be based on the combination of a `Label` and a `property`.
1210
Any Cypher query that searches for nodes with a specific label and some predicate on the property (equality, range or existence) will be planned to use
1311
the index if the cost planner deems that to be the most efficient solution.

modules/ROOT/pages/query-tuning/basic-example.adoc renamed to modules/ROOT/pages/appendix/tutorials/basic-query-tuning.adoc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ RETURN p
607607
This query will find the *'Tom Hanks'* node but as the number of nodes in the database increase it will become slower and slower.
608608
We can profile the query to find out why that is.
609609

610-
You can learn more about the options for profiling queries in xref::query-tuning/query-options.adoc[] but in this case you are going to prefix our query with `PROFILE`:
610+
You can learn more about the options for profiling queries in xref::planning-and-tuning/query-tuning/query-options.adoc[] but in this case you are going to prefix our query with `PROFILE`:
611611

612612
[source, cypher]
613613
----
@@ -646,9 +646,9 @@ ready to start consuming query after 17 ms, results consumed after another 10 ms
646646
The first thing to keep in mind when reading execution plans is that you need to read from the bottom up.
647647

648648
In that vein, starting from the last row, the first thing you notice is that the value in the `Rows` column seems high given there is only one node with the name property *'Tom Hanks'* in the database.
649-
If you look across to the `Operator` column, you will see that xref::execution-plans/operators.adoc#query-plan-all-nodes-scan[AllNodesScan] has been used which means that the query planner scanned through all the nodes in the database.
649+
If you look across to the `Operator` column, you will see that xref::planning-and-tuning/operators/operators-detail.adoc#query-plan-all-nodes-scan[AllNodesScan] has been used which means that the query planner scanned through all the nodes in the database.
650650

651-
The xref::execution-plans/operators.adoc#query-plan-filter[Filter] operator which will check the `name` property on each of the nodes passed through by `AllNodesScan`.
651+
The xref::planning-and-tuning/operators/operators-detail.adoc#query-plan-filter[Filter] operator which will check the `name` property on each of the nodes passed through by `AllNodesScan`.
652652

653653
This seems like an inefficient way of finding *'Tom Hanks'* given that you are looking at many nodes that are not even people and therefore are not what you are looking for.
654654

@@ -700,7 +700,7 @@ Total database accesses: 379, total allocated memory: 184
700700
----
701701

702702
This time the `Rows` value on the last row has reduced so you are not scanning some nodes that you were before which is a good start.
703-
The xref::execution-plans/operators.adoc#query-plan-node-by-label-scan[NodeByLabelScan] operator indicates that you achieved this by first doing a linear scan of all the `Person` nodes in the database.
703+
The xref::planning-and-tuning/operators/operators-detail.adoc#query-plan-node-by-label-scan[NodeByLabelScan] operator indicates that you achieved this by first doing a linear scan of all the `Person` nodes in the database.
704704

705705
Once you have done that, you can again scan through all those nodes using the `Filter` operator, comparing the name property of each one.
706706

@@ -764,5 +764,5 @@ Total database accesses: 5, total allocated memory: 184
764764
1 row
765765
----
766766

767-
Our execution plan is down to a single row and uses the xref::execution-plans/operators.adoc#query-plan-node-index-seek[Node Index Seek] operator which does an index seek (see xref::indexes-for-search-performance.adoc[]) to find the appropriate node.
767+
Our execution plan is down to a single row and uses the xref::planning-and-tuning/operators/operators-detail.adoc#query-plan-node-index-seek[Node Index Seek] operator which does an index seek (see xref::indexes-for-search-performance.adoc[]) to find the appropriate node.
768768

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
:description: List of available tutorials in the Cypher Manual.
2+
= Tutorials and extended examples
3+
4+
* xref:appendix/tutorials/basic-query-tuning.adoc[]
5+
* xref:appendix/tutorials/advanced-query-tuning.adoc[]
6+
* xref:appendix/tutorials/shortestpath-planning.adoc[] - information about how to plan queries using the xref:patterns/concepts.adoc#shortest-path[`shortestPath()` function].

modules/ROOT/pages/execution-plans/shortestpath-planning.adoc renamed to modules/ROOT/pages/appendix/tutorials/shortestpath-planning.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Therefore, in these cases, it is recommended to set `cypher.forbid_exhaustive_sh
2626
== Shortest path -- fast algorithm
2727

2828

29-
.Query evaluated with the fast algorithm
29+
.Query evaluated with the fast algorith
3030
======
3131
3232
////

modules/ROOT/pages/clauses/clause_composition.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -951,8 +951,8 @@ materialize the table of intermediate results before executing the next clause.
951951
This approach would consume a lot of memory for materializing the tables of intermediate results and would generally not perform well.
952952

953953
Instead, Cypher will in general try to interleave the execution of clauses.
954-
This is called xref::execution-plans/index.adoc#eagerness-laziness[lazy evaluation].
954+
This is called xref::planning-and-tuning/execution-plans.adoc#laze-eager-evaluation[lazy evaluation].
955955
It only materializes intermediate results when needed.
956956
In many read-write queries it is unproblematic to execute clauses interleaved, but when it is not,
957957
Cypher must ensure that the table of intermediate results gets materialized at the right time(s).
958-
This is done by inserting an xref::execution-plans/operators.adoc#query-plan-eager[`Eager`] operator into the execution plan.
958+
This is done by inserting an xref::planning-and-tuning/operators/operators-detail.adoc#query-plan-eager[`Eager`] operator into the execution plan.

modules/ROOT/pages/clauses/index.adoc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -234,22 +234,22 @@ m| xref:clauses/transaction-clauses.adoc#query-terminate-transactions[TERMINATE
234234
== Reading hints
235235

236236
These comprise clauses used to specify planner hints when tuning a query.
237-
More details regarding the usage of these -- and query tuning in general -- can be found in xref::query-tuning/using.adoc[Planner hints and the USING keyword].
237+
More details regarding the usage of these -- and query tuning in general -- can be found in xref::planning-and-tuning/query-tuning/using.adoc[Planner hints and the USING keyword].
238238

239239
[options="header"]
240240
|===
241241
| Hint | Description
242242

243-
m| xref::query-tuning/using.adoc#query-using-index-hint[USING INDEX]
243+
m| xref::planning-and-tuning/query-tuning/using.adoc#query-using-index-hint[USING INDEX]
244244
| Index hints are used to specify which index, if any, the planner should use as a starting point.
245245

246-
m| xref::query-tuning/using.adoc#query-using-index-hint[USING INDEX SEEK]
246+
m| xref::planning-and-tuning/query-tuning/using.adoc#query-using-index-hint[USING INDEX SEEK]
247247
| Index seek hint instructs the planner to use an index seek for this clause.
248248

249-
m| xref::query-tuning/using.adoc#query-using-scan-hint[USING SCAN]
249+
m| xref::planning-and-tuning/query-tuning/using.adoc#query-using-scan-hint[USING SCAN]
250250
| Scan hints are used to force the planner to do a label scan (followed by a filtering operation) instead of using an index.
251251

252-
m| xref::query-tuning/using.adoc#query-using-join-hint[USING JOIN]
252+
m| xref::planning-and-tuning/query-tuning/using.adoc#query-using-join-hint[USING JOIN]
253253
| Join hints are used to enforce a join operation at specified points.
254254

255255
|===

0 commit comments

Comments
 (0)