Skip to content

Commit

Permalink
add example query to concepts page
Browse files Browse the repository at this point in the history
  • Loading branch information
JPryce-Aklundh committed Sep 22, 2023
1 parent 2cdec35 commit 8f399df
Showing 1 changed file with 38 additions and 1 deletion.
39 changes: 38 additions & 1 deletion modules/ROOT/pages/planning-and-tuning/runtimes/concepts.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,43 @@ However, each runtime offers advantages and disadvantages, and there are scenari
This is a step-by-step guide to the concepts behind each of the three available Cypher runtimes.
For readers not familiar with reading the execution plans produced by Cypher queries, it is recommended to first read the section on xref:planning-and-tuning/execution-plans.adoc[].

[[runtimes-example-graph]]
== Example graph

The following graph is used for the queries on this page:

image::patterns_qpp_calling_points.svg[width="700",role="middle"]

The graph contains two types of nodes: `Stop` and `Station`.
Each `Stop` on a train service `CALLS_AT` one `Station`, and has the properties `arrives` and `departs` that give the times the train is at the `Station`.
Following the `NEXT` relationship of a `Stop` will give the next `Stop` of a service.

To recreate the graph, run the following query against an empty Neo4j database:

.Query
[source, cypher, role=test-setup]
----
CREATE (pmr:Station {name: 'Peckham Rye'}),
(dmk:Station {name: 'Denmark Hill'}),
(clp:Station {name: 'Clapham High Street'}),
(wwr:Station {name: 'Wandsworth Road'}),
(clj:Station {name: 'Clapham Junction'}),
(s1:Stop {arrives: time('17:19'), departs: time('17:20')}),
(s2:Stop {arrives: time('17:12'), departs: time('17:13')}),
(s3:Stop {arrives: time('17:10'), departs: time('17:11')}),
(s4:Stop {arrives: time('17:06'), departs: time('17:07')}),
(s5:Stop {arrives: time('16:58'), departs: time('17:01')}),
(s6:Stop {arrives: time('17:17'), departs: time('17:20')}),
(s7:Stop {arrives: time('17:08'), departs: time('17:10')}),
(clj)<-[:CALLS_AT]-(s1), (wwr)<-[:CALLS_AT]-(s2),
(clp)<-[:CALLS_AT]-(s3), (dmk)<-[:CALLS_AT]-(s4),
(pmr)<-[:CALLS_AT]-(s5), (clj)<-[:CALLS_AT]-(s6),
(dmk)<-[:CALLS_AT]-(s7),
(s5)-[:NEXT {distance: 1.2}]->(s4),(s4)-[:NEXT {distance: 0.34}]->(s3),
(s3)-[:NEXT {distance: 0.76}]->(s2), (s2)-[:NEXT {distance: 0.3}]->(s1),
(s7)-[:NEXT {distance: 1.4}]->(s6)
----

[[runtimes-slotted-runtime]]
== Slotted runtime

Expand Down Expand Up @@ -316,7 +353,7 @@ As a general rule of thumb, the parallel runtime is not beneficial for queries w
Additionally, though individual queries may run faster when running the parallel runtime, the overall throughput of the database may decrease as a result of running many concurrent queries.

The parallel runtime is accordingly not suitable for transactional processing queries with high throughput workloads.
It is, however, ideal for analytical use cases where the database runs relatively few, but demanding read-queries.


[[runtimes-summary]]
== Summary
Expand Down

0 comments on commit 8f399df

Please sign in to comment.