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/appendix/tutorials/advanced-query-tuning.adoc
+1-3Lines changed: 1 addition & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,11 @@
1
1
:description: Example of some more subtle optimizations based on native index capabilities.
2
-
3
-
4
2
[[advanced-query-tuning-example]]
5
3
= Advanced query tuning example
6
4
7
5
This page describes advanced query optimizations based on native index capabilities.
8
6
9
7
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[].
11
9
In summary, an index will be based on the combination of a `Label` and a `property`.
12
10
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
13
11
the index if the cost planner deems that to be the most efficient solution.
Copy file name to clipboardExpand all lines: modules/ROOT/pages/appendix/tutorials/basic-query-tuning.adoc
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -607,7 +607,7 @@ RETURN p
607
607
This query will find the *'Tom Hanks'* node but as the number of nodes in the database increase it will become slower and slower.
608
608
We can profile the query to find out why that is.
609
609
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`:
611
611
612
612
[source, cypher]
613
613
----
@@ -646,9 +646,9 @@ ready to start consuming query after 17 ms, results consumed after another 10 ms
646
646
The first thing to keep in mind when reading execution plans is that you need to read from the bottom up.
647
647
648
648
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.
650
650
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`.
652
652
653
653
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.
654
654
@@ -700,7 +700,7 @@ Total database accesses: 379, total allocated memory: 184
700
700
----
701
701
702
702
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.
704
704
705
705
Once you have done that, you can again scan through all those nodes using the `Filter` operator, comparing the name property of each one.
706
706
@@ -764,5 +764,5 @@ Total database accesses: 5, total allocated memory: 184
764
764
1 row
765
765
----
766
766
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.
* xref:appendix/tutorials/shortestpath-planning.adoc[] - information about how to plan queries using the xref:patterns/concepts.adoc#shortest-path[`shortestPath()` function].
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].
0 commit comments