cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

How do I produce a profile/explain through cypher-shell and pipeing query file

If yor prepare a file with a Cypher statement that includes either a
profile or explain clause and then
want to pipe that file to bin/cypher-shell, to produce the profile/explain output you must include --format verbose on the command line.

For example, when your file, mycypher.cql, contains

profile match (n:Movies) return count(n);

if you run

cat mycypher.cql | ./cypher-shell

the output will be

Plan: "PROFILE"
Statement: "READ_ONLY"
Version: "CYPHER 3.2"
Planner: "COST"
Runtime: "COMPILED"
Time: 42
DbHits: 0
Rows: 1
count(n)
0

however when running

cat mycypher.cql | ./cypher-shell --format verbose

the output will now be

+--------------------------------------------------------------------------------------+
| Plan      | Statement   | Version      | Planner | Runtime    | Time | DbHits | Rows |
+--------------------------------------------------------------------------------------+
| "PROFILE" | "READ_ONLY" | "CYPHER 3.2" | "COST"  | "COMPILED" | 0    | 0      | 1    |
+--------------------------------------------------------------------------------------+

+--------------------------+----------------+------+---------+-----------+-----------+-------------+---------------------------------------+
| Operator                 | Estimated Rows | Rows | DB Hits | Cache H/M | Time (ms) | Identifiers | Other                                 |
+--------------------------+----------------+------+---------+-----------+-----------+-------------+---------------------------------------+
| +ProduceResults          |              1 |    1 |       0 |       0/0 |     0.019 | count(n)    | 19237                                 |
| |                        +----------------+------+---------+-----------+-----------+-------------+---------------------------------------+
| +NodeCountFromCountStore |              1 |    0 |       1 |       0/0 |     0.029 | count(n)    | 29320; count( (:Movies) ) AS count(n) |
+--------------------------+----------------+------+---------+-----------+-----------+-------------+---------------------------------------+

+----------+
| count(n) |
+----------+
| 0        |
+----------+
3 REPLIES 3

Is it possible to get a similar result working directly in the Neo4j Browser?

did you try --format verbose ?

@michael.hunger I as trying to do it directly in the browser command line rather than the terminal. I was talking with @mdfrenchman at work and he recommended I go through the bolt driver since you can apparently pull dbhits from there. So I am currently giving that a go.

Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

All the sessions of the conference are now available online