Reputation: 1180
I'm learning Cypher query language. I have the following query:
MATCH path = (:Disease {name: 'influenza'})-[:PRESENTS_DpS]->(:Symptom)<-[:PRESENTS_DpS]-(:Disease {name: 'asthma'})
RETURN path
I want a better understanding of what does this query do, e.g. in which order are commands executed, is there an order like in mathematics (priority of operators, etc.).
I use Memgraph Lab for querying.
Upvotes: 0
Views: 113
Reputation: 1180
If you mean if there is a way for Memgraph Lab to explain to you in "human spoken language" what is going on, the answer is no.
What you can do is to use EXPLAIN
Cypher clause. Simply prefix your code with it so that it looks like this:
EXPLAIN MATCH path = (:Disease {name: 'influenza'})-[:PRESENTS_DpS]->(:Symptom)<-[:PRESENTS_DpS]-(:Disease {name: 'asthma'})
RETURN path
Before a Cypher query is executed, it is converted into an internal form suitable for execution, known as a plan. A plan is a tree-like data structure describing a pipeline of operations which will be performed on the database in order to yield the results for a given query. Every node within a plan is known as a logical operator and describes a particular operation.
Because a plan represents a pipeline, the logical operators are iteratively executed as data passes from one logical operator to the other. Every logical operator pulls data from the logical operator(s) preceding it, processes it and passes it onto the logical operator next in the pipeline for further processing.
Using the EXPLAIN
operator, it is possible for the user to inspect the produced plan and gain insight into the execution of a query.
The output of the EXPLAIN
query is a representation of the produced plan. Every logical operator within the plan starts with an asterisk character (*
) and is followed by its name (and sometimes additional information). The execution of the query proceeds iteratively (generating one entry of the result set at a time), with data flowing from the bottom-most logical operator(s) (the start of the pipeline) to the top-most logical operator(s) (the end of the pipeline).
For more details take a look at the Inspecting queries documentation.
Upvotes: 0