知识库

如何通过 cypher-shell 和管道传输查询文件来生成 profile/explain

如果您准备了一个包含profile 或 explain子句的 Cypher 语句文件,并希望将该文件通过管道传递给 bin/cypher-shell,要生成 profile/explain 输出,必须在命令行中加入 --format verbose 参数。

例如,当您的文件 mycypher.cql 包含以下内容时

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

如果您运行

$ cat mycypher.cql | ./cypher-shell

输出将会是

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

然而,当运行

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

现在输出将会是

+--------------------------------------------------------------------------------------+
| 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        |
+----------+
© . This site is unofficial and not affiliated with Neo4j, Inc.