在论坛、Github Issue 分享 PROFILE EXPLAIN 执行计划的最佳姿势。

目前来说,在 3.x 里最推荐的分享方式是文本的表格,而不是 CSV(可读性差)/ dot 文件(缺失信息)/ 截图(。。。。)

  1. 获得执行计划
    从 console 中,先执行 :profile <输出文件名>.log 再执行 PROFILE 或者 EXPLAIN 开头的查询,就会把可以直接贴过来的执行计划导出到进入 console 所在的目录。
:profile profile.log
PROFILE MATCH xxxx RETURN yyy
  1. 贴到论坛

可以用这个代码的格式包裹起来

也可以作为附件上传 profile.log

比如:

(root@nebula) [basketballplayer]> profile GO FROM 'player100' OVER follow WHERE rank(edge) < 100 YIELD src(edge), dst(edge), rank(edge)
+-------------+-------------+------------+
| src(EDGE)   | dst(EDGE)   | rank(EDGE) |
+-------------+-------------+------------+
| "player100" | "player101" | 0          |
| "player100" | "player125" | 0          |
+-------------+-------------+------------+
Got 2 rows (time spent 4.356ms/37.68475ms)

Execution Plan (optimize time 264 us)

-----+-----------+--------------+--------------------------------------+------------------------------
| id | name      | dependencies | profiling data                       | operator info               |
-----+-----------+--------------+--------------------------------------+------------------------------
|  5 | Project   | 4            | {                                    | outputVar: {                |
|    |           |              |   "execTime": "29(us)",              |   "colNames": [             |
|    |           |              |   "rows": 2,                         |     "src(EDGE)",            |
|    |           |              |   "totalTime": "33(us)",             |     "dst(EDGE)",            |
|    |           |              |   "version": 0                       |     "rank(EDGE)"            |
|    |           |              | }                                    |   ],                        |
|    |           |              |                                      |   "type": "DATASET",        |
|    |           |              |                                      |   "name": "__Project_5"     |
|    |           |              |                                      | }                           |
|    |           |              |                                      | inputVar: __Filter_4        |
1 个赞