match 无法查到,fetch 可以

提问参考模版:

  • nebula 版本:v3.4.1
  • 部署方式:分布式
  • 安装方式: RPM
  • 是否上生产环境:Y
  • 硬件信息
    • 磁盘( 推荐使用 SSD)
    • CPU、内存信息
  • 问题的具体描述
  • 相关的 meta / storage / graph info 日志信息(尽量使用文本形式方便
(root@nebula) [Tender]> MATCH (a)-[e:Win]->(b) WHERE id(a)=="c89b6d71c0317215b20ab84547ac282e" AND id(b)=="49c823aeeb26abc6cda1fe419d753172"  RETURN e.cnt as cnt, id(b) as id, b.Company.name as name
+-----+----+------+
| cnt | id | name |
+-----+----+------+
+-----+----+------+
Empty set (time spent 28.12ms/52.653371ms)

Wed, 02 Aug 2023 13:37:35 CST


(root@nebula) [Tender]> fetch prop on Win "c89b6d71c0317215b20ab84547ac282e"->"49c823aeeb26abc6cda1fe419d753172" yield properties(edge)
+-----------------------------------+
| properties(EDGE)                  |
+-----------------------------------+
| {cnt: 4, create_time: 1690947993} |
+-----------------------------------+
Got 1 rows (time spent 563µs/25.551647ms)

Wed, 02 Aug 2023 13:38:19 CS

profile:


(root@nebula) [Tender]> profile  MATCH (a)-[e:Win]->(b) WHERE id(a)=="c89b6d71c0317215b20ab84547ac282e" AND id(b)=="49c823aeeb26abc6cda1fe419d753172"  RETURN e.cnt as cnt, id(b) as id, b.Company.name as name
+-----+----+------+
| cnt | id | name |
+-----+----+------+
+-----+----+------+
Empty set (time spent 30.641ms/55.535261ms)

Execution Plan (optimize time 254 us)

-----+----------------+--------------+-----------------------------------------+-----------------------------------------------------------------------------------------------------------------
| id | name           | dependencies | profiling data                          | operator info                                                                                                  |
-----+----------------+--------------+-----------------------------------------+-----------------------------------------------------------------------------------------------------------------
| 11 | Project        | 9            | {                                       | outputVar: {                                                                                                   |
|    |                |              |   "execTime": "16(us)",                 |   "colNames": [                                                                                                |
|    |                |              |   "rows": 0,                            |     "cnt",                                                                                                     |
|    |                |              |   "totalTime": "19(us)",                |     "id",                                                                                                      |
|    |                |              |   "version": 0                          |     "name"                                                                                                     |
|    |                |              | }                                       |   ],                                                                                                           |
|    |                |              |                                         |   "type": "DATASET",                                                                                           |
|    |                |              |                                         |   "name": "__Project_8"                                                                                        |
|    |                |              |                                         | }                                                                                                              |
|    |                |              |                                         | inputVar: __Filter_9                                                                                           |
|    |                |              |                                         | columns: [                                                                                                     |
|    |                |              |                                         |   "$-.e[0].cnt AS cnt",                                                                                        |
|    |                |              |                                         |   "id($-.b) AS id",                                                                                            |
|    |                |              |                                         |   "$-.b.Company.name AS name"                                                                                  |
|    |                |              |                                         | ]                                                                                                              |
-----+----------------+--------------+-----------------------------------------+-----------------------------------------------------------------------------------------------------------------
|  9 | Filter         | 5            | {                                       | outputVar: {                                                                                                   |
|    |                |              |   "execTime": "2383(us)",               |   "colNames": [                                                                                                |
|    |                |              |   "rows": 0,                            |     "a",                                                                                                       |
|    |                |              |   "totalTime": "2386(us)",              |     "e",                                                                                                       |
|    |                |              |   "version": 0                          |     "b"                                                                                                        |
|    |                |              | }                                       |   ],                                                                                                           |
|    |                |              |                                         |   "type": "DATASET",                                                                                           |
|    |                |              |                                         |   "name": "__Filter_9"                                                                                         |
|    |                |              |                                         | }                                                                                                              |
|    |                |              |                                         | inputVar: __AppendVertices_5                                                                                   |
|    |                |              |                                         | condition: ((id($-.a)=="c89b6d71c0317215b20ab84547ac282e") AND (id($-.b)=="49c823aeeb26abc6cda1fe419d753172")) |
|    |                |              |                                         | isStable: false                                                                                                |
-----+----------------+--------------+-----------------------------------------+-----------------------------------------------------------------------------------------------------------------
|  5 | AppendVertices | 4            | {                                       | outputVar: {                                                                                                   |
|    |                |              |   "execTime": "10076(us)",              |   "colNames": [                                                                                                |
|    |                |              |   "resp[0]": {                          |     "a",                                                                                                       |
|    |                |              |     "exec": "1021(us)",                 |     "e",                                                                                                       |
|    |                |              |     "host": "10.0.20.168:9779",         |     "b"                                                                                                        |
|    |                |              |     "total": "2091(us)"                 |   ],                                                                                                           |
|    |                |              |   },                                    |   "type": "DATASET",                                                                                           |
|    |                |              |   "resp[1]": {                          |   "name": "__AppendVertices_5"                                                                                 |
|    |                |              |     "exec": "943(us)",                  | }                                                                                                              |
|    |                |              |     "host": "10.0.20.171:9779",         | inputVar: __Traverse_4                                                                                         |
|    |                |              |     "total": "1946(us)"                 | space: 472                                                                                                     |
|    |                |              |   },                                    | dedup: true                                                                                                    |
|    |                |              |   "resp[2]": {                          | limit: -1                                                                                                      |
|    |                |              |     "exec": "937(us)",                  | filter:                                                                                                        |
|    |                |              |     "host": "10.0.20.167:9779",         | orderBy: []                                                                                                    |
|    |                |              |     "total": "2192(us)"                 | src: none_direct_dst($-.e)                                                                                     |
|    |                |              |   },                                    | props: [                                                                                                       |
|    |                |              |   "resp[3]": {                          |   {                                                                                                            |
|    |                |              |     "exec": "924(us)",                  |     "props": [                                                                                                 |
|    |                |              |     "host": "10.0.20.169:9779",         |       "name"                                                                                                   |
|    |                |              |     "total": "2032(us)"                 |     ],                                                                                                         |
|    |                |              |   },                                    |     "tagId": 474                                                                                               |
|    |                |              |   "resp[4]": {                          |   }                                                                                                            |
|    |                |              |     "exec": "1035(us)",                 | ]                                                                                                              |
|    |                |              |     "host": "10.0.20.170:9779",         | exprs:                                                                                                         |
|    |                |              |     "total": "2172(us)"                 | vertex_filter:                                                                                                 |
|    |                |              |   },                                    | if_track_previous_path: true                                                                                   |
|    |                |              |   "resp[5]": {                          |                                                                                                                |
|    |                |              |     "exec": "991(us)",                  |                                                                                                                |
|    |                |              |     "host": "10.0.20.166:9779",         |                                                                                                                |
|    |                |              |     "total": "2011(us)"                 |                                                                                                                |
|    |                |              |   },                                    |                                                                                                                |
|    |                |              |   "rows": 3200,                         |                                                                                                                |
|    |                |              |   "totalTime": "11434(us)",             |                                                                                                                |
|    |                |              |   "total_rpc": "6059(us)",              |                                                                                                                |
|    |                |              |   "version": 0                          |                                                                                                                |
|    |                |              | }                                       |                                                                                                                |
-----+----------------+--------------+-----------------------------------------+-----------------------------------------------------------------------------------------------------------------
|  4 | Traverse       | 2            | {                                       | outputVar: {                                                                                                   |
|    |                |              |   "execTime": "4225(us)",               |   "colNames": [                                                                                                |
|    |                |              |   "rows": 3564,                         |     "a",                                                                                                       |
|    |                |              |   "step[1]": [                          |     "e"                                                                                                        |
|    |                |              |     {                                   |   ],                                                                                                           |
|    |                |              |       "exec": "5660(us)",               |   "type": "DATASET",                                                                                           |
|    |                |              |       "host": "10.0.20.166:9779",       |   "name": "__Traverse_4"                                                                                       |
|    |                |              |       "storage_detail": {               | }                                                                                                              |
|    |                |              |         "GetNeighborsNode": "1977(us)", | inputVar: __Dedup_2                                                                                            |
|    |                |              |         "HashJoinNode": "29(us)",       | space: 472                                                                                                     |
|    |                |              |         "RelNode": "1977(us)",          | dedup: true                                                                                                    |
|    |                |              |         "SingleEdgeNode": "28(us)"      | limit: -1                                                                                                      |
|    |                |              |       },                                | filter:                                                                                                        |
|    |                |              |       "total": "7042(us)",              | orderBy: []                                                                                                    |
|    |                |              |       "total_rpc_time": "7096(us)",     | src: $-._vid                                                                                                   |
|    |                |              |       "vertices": 1                     | edgeTypes: []                                                                                                  |
|    |                |              |     }                                   | edgeDirection: OUT_EDGE                                                                                        |
|    |                |              |   ],                                    | vertexProps:                                                                                                   |
|    |                |              |   "totalTime": "11338(us)",             | edgeProps: [                                                                                                   |
|    |                |              |   "version": 0                          |   {                                                                                                            |
|    |                |              | }                                       |     "props": [                                                                                                 |
|    |                |              |                                         |       "_type",                                                                                                 |
|    |                |              |                                         |       "_rank",                                                                                                 |
|    |                |              |                                         |       "_dst",                                                                                                  |
|    |                |              |                                         |       "cnt"                                                                                                    |
|    |                |              |                                         |     ],                                                                                                         |
|    |                |              |                                         |     "type": 476                                                                                                |
|    |                |              |                                         |   }                                                                                                            |
|    |                |              |                                         | ]                                                                                                              |
|    |                |              |                                         | statProps:                                                                                                     |
|    |                |              |                                         | exprs:                                                                                                         |
|    |                |              |                                         | random: false                                                                                                  |
|    |                |              |                                         | steps: 1..1                                                                                                    |
|    |                |              |                                         | vertex filter:                                                                                                 |
|    |                |              |                                         | edge filter:                                                                                                   |
|    |                |              |                                         | if_track_previous_path: false                                                                                  |
|    |                |              |                                         | first step filter:                                                                                             |
|    |                |              |                                         | tag filter:                                                                                                    |
-----+----------------+--------------+-----------------------------------------+-----------------------------------------------------------------------------------------------------------------
|  2 | Dedup          | 1            | {                                       | outputVar: {                                                                                                   |
|    |                |              |   "execTime": "2(us)",                  |   "colNames": [                                                                                                |
|    |                |              |   "rows": 1,                            |     "_vid"                                                                                                     |
|    |                |              |   "totalTime": "3(us)",                 |   ],                                                                                                           |
|    |                |              |   "version": 0                          |   "type": "DATASET",                                                                                           |
|    |                |              | }                                       |   "name": "__Dedup_2"                                                                                          |
|    |                |              |                                         | }                                                                                                              |
|    |                |              |                                         | inputVar: __VAR_0                                                                                              |
-----+----------------+--------------+-----------------------------------------+-----------------------------------------------------------------------------------------------------------------
|  1 | PassThrough    | 3            | {                                       | outputVar: {                                                                                                   |
|    |                |              |   "execTime": "2(us)",                  |   "colNames": [                                                                                                |
|    |                |              |   "rows": 0,                            |     "_vid"                                                                                                     |
|    |                |              |   "totalTime": "3(us)",                 |   ],                                                                                                           |
|    |                |              |   "version": 0                          |   "type": "DATASET",                                                                                           |
|    |                |              | }                                       |   "name": "__VAR_0"                                                                                            |
|    |                |              |                                         | }                                                                                                              |
|    |                |              |                                         | inputVar:                                                                                                      |
-----+----------------+--------------+-----------------------------------------+-----------------------------------------------------------------------------------------------------------------
|  3 | Start          |              | {                                       | outputVar: {                                                                                                   |
|    |                |              |   "execTime": "0(us)",                  |   "colNames": [],                                                                                              |
|    |                |              |   "rows": 0,                            |   "type": "DATASET",                                                                                           |
|    |                |              |   "totalTime": "15(us)",                |   "name": "__Start_3"                                                                                          |
|    |                |              |   "version": 0                          | }                                                                                                              |
|    |                |              | }                                       |                                                                                                                |
-----+----------------+--------------+-----------------------------------------+-----------------------------------------------------------------------------------------------------------------

Wed, 02 Aug 2023 13:42:08 CST

看第4步,traverse 有rows:2564 的,step5 AppendVertices 不知道干嘛的,也是有数据的 怎么6 filter 之后就没了

建议你单独查一下 49c823aeeb26abc6cda1fe419d753172 这个点是否存在,如果不存在,那么是 match 不到的。但因为 nebula 支持悬挂边,所以可以查到边的数据。

1 个赞

想过这个可能性,看了下是有的

试一下

GO FROM "c89b6d71c0317215b20ab84547ac282e" OVER WIN
WHERE id($$)=="49c823aeeb26abc6cda1fe419d753172"
YIELD edge as e, $$ as b

可能是没有索引的问题……

从 3.5.0 版本开始,MATCH语句支持全表扫描,即在不使用任何索引或者过滤条件的情况下可遍历图中点或边。在此之前的版本中,MATCH 语句在某些情况下需要索引才能执行查询或者需要使用LIMIT限制输出结果数量。

https://docs.nebula-graph.com.cn/3.5.0/3.ngql-guide/7.general-query-statements/2.match/

破案了,看了操作日志,确实还是match 无法查询悬挂边导致的。
刚好那实体在match 的时候被删了,又推了一遍新建的

2 个赞

此话题已在最后回复的 7 天后被自动关闭。不再允许新回复。