Sorry @akhilravuri1 , After revisiting this, I think maybe for now match (m:t1)-[e:e1]->(n:t1) WHERE id(m)=="10" AND id(n)=="11" return e
is the best, as the getEdges/fetch edge not yet support wildcard range.
The differences between MATCH and FETCH here are MATCH now starts from the vid and FETCH is doing this by getEdge().
for this reason, I see to explicitly providing tags of m, and n could be slightly faster.
(root@nebula) [basketballplayer]> match (m:t1)-[e:e1]->(n:t1) WHERE id(m)=="10" AND id(n)=="11" return e
+------------------------+
| e |
+------------------------+
| [:e1 "10"->"11" @0 {}] |
| [:e1 "10"->"11" @1 {}] |
| [:e1 "10"->"11" @2 {}] |
+------------------------+
Got 3 rows (time spent 4438/8841 us)
Wed, 13 Apr 2022 10:05:48 CST
(root@nebula) [basketballplayer]> match (m)-[e:e1]->(n) WHERE id(m)=="10" AND id(n)=="11" return e
+------------------------+
| e |
+------------------------+
| [:e1 "10"->"11" @0 {}] |
| [:e1 "10"->"11" @1 {}] |
| [:e1 "10"->"11" @2 {}] |
+------------------------+
Got 3 rows (time spent 4814/9435 us)
Wed, 13 Apr 2022 10:05:56 CST
I will create an issue on requesting getEdges() and fetch edge to support get wildcard rank.
Thanks!
Also, match in my env could be faster as Prune properties/no need to collect columns of dedup by jievince · Pull Request #3953 · vesoft-inc/nebula · GitHub is introduced. It will be in 3.1(already in master)
(root@nebula) [basketballplayer]> explain match (m:t1)-[e:e1]->(n:t1) WHERE id(m)=="10" AND id(n)=="11" return e
Execution succeeded (time spent 1260/12944 us)
Execution Plan (optimize time 495 us)
-----+----------------+--------------+----------------+-----------------------------------------------------
| id | name | dependencies | profiling data | operator info |
-----+----------------+--------------+----------------+-----------------------------------------------------
| 13 | Project | 10 | | outputVar: [ |
| | | | | { |
| | | | | "colNames": [ |
| | | | | "e" |
| | | | | ], |
| | | | | "type": "DATASET", |
| | | | | "name": "__Project_8" |
| | | | | } |
| | | | | ] |
| | | | | inputVar: __Filter_10 |
| | | | | columns: [ |
| | | | | "$-.e[0]" |
| | | | | ] |
-----+----------------+--------------+----------------+-----------------------------------------------------
| 10 | Filter | 5 | | outputVar: [ |
| | | | | { |
| | | | | "colNames": [ |
| | | | | "m", |
| | | | | "e", |
| | | | | "n" |
| | | | | ], |
| | | | | "type": "DATASET", |
| | | | | "name": "__Filter_10" |
| | | | | } |
| | | | | ] |
| | | | | inputVar: __AppendVertices_5 |
| | | | | condition: ((id($-.m)=="10") AND (id($-.n)=="11")) |
| | | | | isStable: false |
-----+----------------+--------------+----------------+-----------------------------------------------------
| 5 | AppendVertices | 4 | | outputVar: [ |
| | | | | { |
| | | | | "colNames": [ |
| | | | | "m", |
| | | | | "e", |
| | | | | "n" |
| | | | | ], |
| | | | | "type": "DATASET", |
| | | | | "name": "__AppendVertices_5" |
| | | | | } |
| | | | | ] |
| | | | | inputVar: __Traverse_4 |
| | | | | space: 16 |
| | | | | dedup: true |
| | | | | limit: 0 |
| | | | | filter: |
| | | | | orderBy: [] |
| | | | | src: none_direct_dst($-.e) |
| | | | | props: [ |
| | | | | { |
| | | | | "props": [ |
| | | | | "name", |
| | | | | "_tag" |
| | | | | ], |
| | | | | "tagId": 18 |
| | | | | }, |
| | | | | { |
| | | | | "props": [ |
| | | | | "name", |
| | | | | "age", |
| | | | | "_tag" |
| | | | | ], |
| | | | | "tagId": 23 |
| | | | | }, |
| | | | | { |
| | | | | "props": [ |
| | | | | "_tag" |
| | | | | ], |
| | | | | "tagId": 28 |
| | | | | }, |
| | | | | { |
| | | | | "props": [ |
| | | | | "name", |
| | | | | "age", |
| | | | | "_tag" |
| | | | | ], |
| | | | | "tagId": 17 |
| | | | | } |
| | | | | ] |
| | | | | exprs: |
| | | | | vertex_filter: t1._tag IS NOT EMPTY |
| | | | | if_track_previous_path: true |
-----+----------------+--------------+----------------+-----------------------------------------------------
| 4 | Traverse | 2 | | outputVar: [ |
| | | | | { |
| | | | | "colNames": [ |
| | | | | "m", |
| | | | | "e" |
| | | | | ], |
| | | | | "type": "DATASET", |
| | | | | "name": "__Traverse_4" |
| | | | | } |
| | | | | ] |
| | | | | inputVar: __Dedup_2 |
| | | | | space: 16 |
| | | | | dedup: true |
| | | | | limit: -1 |
| | | | | filter: |
| | | | | orderBy: [] |
| | | | | src: $-._vid |
| | | | | edgeTypes: [] |
| | | | | edgeDirection: OUT_EDGE |
| | | | | vertexProps: [ |
| | | | | { |
| | | | | "props": [ |
| | | | | "name", |
| | | | | "_tag" |
| | | | | ], |
| | | | | "tagId": 18 |
| | | | | }, |
| | | | | { |
| | | | | "props": [ |
| | | | | "name", |
| | | | | "age", |
| | | | | "_tag" |
| | | | | ], |
| | | | | "tagId": 23 |
| | | | | }, |
| | | | | { |
| | | | | "props": [ |
| | | | | "_tag" |
| | | | | ], |
| | | | | "tagId": 28 |
| | | | | }, |
| | | | | { |
| | | | | "props": [ |
| | | | | "name", |
| | | | | "age", |
| | | | | "_tag" |
| | | | | ], |
| | | | | "tagId": 17 |
| | | | | } |
| | | | | ] |
| | | | | edgeProps: [ |
| | | | | { |
| | | | | "props": [ |
| | | | | "_src", |
| | | | | "_type", |
| | | | | "_rank", |
| | | | | "_dst" |
| | | | | ], |
| | | | | "type": "26" |
| | | | | } |
| | | | | ] |
| | | | | statProps: |
| | | | | exprs: |
| | | | | random: false |
| | | | | vertex filter: t1._tag IS NOT EMPTY |
| | | | | if_track_previous_path: false |
-----+----------------+--------------+----------------+-----------------------------------------------------
| 2 | Dedup | 1 | | outputVar: [ |
| | | | | { |
| | | | | "colNames": [ |
| | | | | "_vid" |
| | | | | ], |
| | | | | "type": "DATASET", |
| | | | | "name": "__Dedup_2" |
| | | | | } |
| | | | | ] |
| | | | | inputVar: __VAR_0 |
-----+----------------+--------------+----------------+-----------------------------------------------------
| 1 | PassThrough | 3 | | outputVar: [ |
| | | | | { |
| | | | | "colNames": [ |
| | | | | "_vid" |
| | | | | ], |
| | | | | "type": "DATASET", |
| | | | | "name": "__VAR_0" |
| | | | | } |
| | | | | ] |
| | | | | inputVar: |
-----+----------------+--------------+----------------+-----------------------------------------------------
| 3 | Start | | | outputVar: [ |
| | | | | { |
| | | | | "colNames": [], |
| | | | | "type": "DATASET", |
| | | | | "name": "__Start_3" |
| | | | | } |
| | | | | ] |
-----+----------------+--------------+----------------+-----------------------------------------------------
Wed, 13 Apr 2022 10:11:16 CST
(root@nebula) [basketballplayer]> explain FETCH PROP ON e1 "10" -> "11" YIELD edge AS e
Execution succeeded (time spent 591/5097 us)
Execution Plan (optimize time 95 us)
-----+----------+--------------+----------------+-----------------------------------------------------------------------------------------
| id | name | dependencies | profiling data | operator info |
-----+----------+--------------+----------------+-----------------------------------------------------------------------------------------
| 3 | Project | 2 | | outputVar: [ |
| | | | | { |
| | | | | "colNames": [ |
| | | | | "e" |
| | | | | ], |
| | | | | "type": "DATASET", |
| | | | | "name": "__Project_3" |
| | | | | } |
| | | | | ] |
| | | | | inputVar: __Filter_2 |
| | | | | columns: [ |
| | | | | "EDGE AS e" |
| | | | | ] |
-----+----------+--------------+----------------+-----------------------------------------------------------------------------------------
| 2 | Filter | 1 | | outputVar: [ |
| | | | | { |
| | | | | "colNames": [], |
| | | | | "type": "DATASET", |
| | | | | "name": "__Filter_2" |
| | | | | } |
| | | | | ] |
| | | | | inputVar: __GetEdges_1 |
| | | | | condition: ((__EMPTY__!=e1._src) AND ((__EMPTY__!=e1._dst) AND (__EMPTY__!=e1._rank))) |
| | | | | isStable: false |
-----+----------+--------------+----------------+-----------------------------------------------------------------------------------------
| 1 | GetEdges | 0 | | outputVar: [ |
| | | | | { |
| | | | | "colNames": [], |
| | | | | "type": "DATASET", |
| | | | | "name": "__GetEdges_1" |
| | | | | } |
| | | | | ] |
| | | | | inputVar: __VAR_0 |
| | | | | space: 16 |
| | | | | dedup: false |
| | | | | limit: 9223372036854775807 |
| | | | | filter: |
| | | | | orderBy: [] |
| | | | | src: COLUMN[0] |
| | | | | type: 26 |
| | | | | ranking: COLUMN[1] |
| | | | | dst: COLUMN[2] |
| | | | | props: [ |
| | | | | { |
| | | | | "props": [ |
| | | | | "_dst", |
| | | | | "_rank", |
| | | | | "_src", |
| | | | | "_type" |
| | | | | ], |
| | | | | "type": "26" |
| | | | | } |
| | | | | ] |
| | | | | exprs: |
-----+----------+--------------+----------------+-----------------------------------------------------------------------------------------
| 0 | Start | | | outputVar: [ |
| | | | | { |
| | | | | "colNames": [], |
| | | | | "type": "DATASET", |
| | | | | "name": "__Start_0" |
| | | | | } |
| | | | | ] |
-----+----------+--------------+----------------+-----------------------------------------------------------------------------------------
Wed, 13 Apr 2022 10:11:22 CST
issue raised: FETCH EDGE for wildcard of rank · Issue #4144 · vesoft-inc/nebula · GitHub