Closed llinzhe closed 1 year ago
:param p0 => 'account001';
MATCH (n: account) WHERE n.account.accountUuid == $p0 RETURN n;
试试这个?
打印出来的 result 是最原始的 ResultSet,在做 orm 处理之前, 出现不一致的情况有点不太好排查。
MATCH (n: account) WHERE n.account.accountUuid == $p0 RETURN n;
- nGql:USE userProfile;
MATCH (n: account) WHERE n.account.accountUuid == $p0 RETURN n;
- params: {p0=account001}
- result:ColumnName: [n], Rows: []
这个还是不行
打印出来的 result 是最原始的 ResultSet,在做 orm 处理之前, 出现不一致的情况有点不太好排查。
嗯嗯,session的执行结果就是null了。这点比较奇怪
接口返回结果有吗,应该不会是toString的问题吧
接口返回结果有吗,应该不会是toString的问题吧
我打个断点看看~
接口返回结果有吗,应该不会是toString的问题吧
{"columnNames":["n"],"empty":true,"comment":"","spaceName":"userProfile","latency":1881,"planDesc":null,"errorCode":0,"succeeded":true,"errorMessage":"","rows":[]}
返回的时候就是[]了
:param p0 => 'account001'; MATCH (n: account) WHERE n.account.accountUuid == $p0 RETURN n;
那这个在console执行有值吗,在想会不会是参数类型的问题
:param p0 => 'account001'; MATCH (n: account) WHERE n.account.accountUuid == $p0 RETURN n;
那这个在console执行有值吗,在想会不会是参数类型的问题
这个也是没有值的~
:param p0 => 'account001'; MATCH (n: account) WHERE n.account.accountUuid == $p0 RETURN n;
那这个在console执行有值吗,在想会不会是参数类型的问题
这个也是没有值的~
会不会是cypher param的问题@wey-gu 可以提供一下nebula的版本吗@llinzhe
:param p0 => 'account001'; MATCH (n: account) WHERE n.account.accountUuid == $p0 RETURN n;
版本是3.2.0
版本:3.2.0
你先把 $p0换成 '${p0}',可以避开这个问题,两种参数替换的机制不一样。
'${p0}' 是执行前替换。 $p0 是执行到数据库时,由数据库替换。 如果参数是数字,单引号可以不用
嗯嗯 改为'${p0}'后可以成功获取数据。
你先把 换成p0换成′{p0}',可以避开这个问题,两种参数替换的机制不一样。
'${p0}' 是执行前替换。 $p0 是执行到数据库时,由数据库替换。 如果参数是数字,单引号可以不用
感谢~
:param p0 => 'account001'; MATCH (n: account) WHERE n.account.accountUuid == $p0 RETURN n;
那这个在console执行有值吗,在想会不会是参数类型的问题
这个也是没有值的~
可以 profile 一下这个 查询么?
profile MATCH (n: account) WHERE n.account.accountUuid == $p0 RETURN n;
profile MATCH (n: account) WHERE n.account.accountUuid == $p0 RETURN n;
(root@nebula) [userProfile]> profile MATCH (n: account) WHERE n.account.accountUuid == $p0 RETURN n;
+---+
| n |
+---+
+---+
Empty set (time spent 1776/2263 us)
Execution Plan (optimize time 128 us)
-----+----------------+--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------
| id | name | dependencies | profiling data | operator info |
-----+----------------+--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------
| 6 | Project | 5 | ver: 0, rows: 0, execTime: 10us, totalTime: 12us | outputVar: { |
| | | | | "colNames": [ |
| | | | | "n" |
| | | | | ], |
| | | | | "type": "DATASET", |
| | | | | "name": "__Project_6" |
| | | | | } |
| | | | | inputVar: __Filter_5 |
| | | | | columns: [ |
| | | | | "$n" |
| | | | | ] |
-----+----------------+--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------
| 5 | Filter | 8 | ver: 0, rows: 0, execTime: 3us, totalTime: 4us | outputVar: { |
| | | | | "colNames": [ |
| | | | | "n" |
| | | | | ], |
| | | | | "type": "DATASET", |
| | | | | "name": "__Filter_5" |
| | | | | } |
| | | | | inputVar: __Project_4 |
| | | | | condition: (n.account.accountUuid==$p0) |
| | | | | isStable: false |
-----+----------------+--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------
| 8 | AppendVertices | 1 | ver: 0, rows: 0, execTime: 12us, totalTime: 14us | outputVar: { |
| | | | | "colNames": [ |
| | | | | "n" |
| | | | | ], |
| | | | | "type": "DATASET", |
| | | | | "name": "__Project_4" |
| | | | | } |
| | | | | inputVar: __IndexScan_1 |
| | | | | space: 1 |
| | | | | dedup: true |
| | | | | limit: -1 |
| | | | | filter: account._tag IS NOT EMPTY |
| | | | | orderBy: [] |
| | | | | src: $_vid |
| | | | | props: [ |
| | | | | { |
| | | | | "props": [ |
| | | | | "token", |
| | | | | "_tag" |
| | | | | ], |
| | | | | "tagId": 5 |
| | | | | }, |
| | | | | { |
| | | | | "props": [ |
| | | | | "accountUuid", |
| | | | | "create_time", |
| | | | | "_tag" |
| | | | | ], |
| | | | | "tagId": 2 |
| | | | | }, |
| | | | | { |
| | | | | "props": [ |
| | | | | "accountUuid", |
| | | | | "createTime", |
| | | | | "_tag" |
| | | | | ], |
| | | | | "tagId": 13 |
| | | | | } |
| | | | | ] |
| | | | | exprs: |
| | | | | vertex_filter: |
| | | | | if_track_previous_path: false |
-----+----------------+--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------
| 1 | IndexScan | 2 | { | outputVar: { |
| | | | ver: 0, rows: 0, execTime: 0us, totalTime: 1038us | "colNames": [ |
| | | | storage_detail: {IndexLimitNode(limit=9223372036854775807):145(us),IndexProjectionNode(projectColumn=[_vid]):145(us),IndexVertexScanNode(IndexID=14, Path=()):148(us)} | "_vid" |
| | | | "127.0.0.1":9779 exec/total: 219(us)/922(us) | ], |
| | | | } | "type": "DATASET", |
| | | | | "name": "__IndexScan_1" |
| | | | | } |
| | | | | inputVar: |
| | | | | space: 1 |
| | | | | dedup: false |
| | | | | limit: 9223372036854775807 |
| | | | | filter: |
| | | | | orderBy: [] |
| | | | | schemaId: 13 |
| | | | | isEdge: false |
| | | | | returnCols: [ |
| | | | | "_vid" |
| | | | | ] |
| | | | | indexCtx: [ |
| | | | | { |
| | | | | "columnHints": [], |
| | | | | "filter": "", |
| | | | | "index_id": 14 |
| | | | | } |
| | | | | ] |
-----+----------------+--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------
| 2 | Start | | ver: 0, rows: 0, execTime: 0us, totalTime: 28us | outputVar: { |
| | | | | "colNames": [], |
| | | | | "type": "DATASET", |
| | | | | "name": "__Start_2" |
| | | | | } |
-----+----------------+--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------
Wed, 02 Nov 2022 07:58:27 EDT
profile MATCH (n: account) WHERE n.account.accountUuid == $p0 RETURN n;
(root@nebula) [userProfile]> profile MATCH (n: account) WHERE n.account.accountUuid == $p0 RETURN n; +---+ | n | +---+ +---+ Empty set (time spent 1776/2263 us) Execution Plan (optimize time 128 us) -----+----------------+--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------ | id | name | dependencies | profiling data | operator info | -----+----------------+--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------ | 6 | Project | 5 | ver: 0, rows: 0, execTime: 10us, totalTime: 12us | outputVar: { | | | | | | "colNames": [ | | | | | | "n" | | | | | | ], | | | | | | "type": "DATASET", | | | | | | "name": "__Project_6" | | | | | | } | | | | | | inputVar: __Filter_5 | | | | | | columns: [ | | | | | | "$n" | | | | | | ] | -----+----------------+--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------ | 5 | Filter | 8 | ver: 0, rows: 0, execTime: 3us, totalTime: 4us | outputVar: { | | | | | | "colNames": [ | | | | | | "n" | | | | | | ], | | | | | | "type": "DATASET", | | | | | | "name": "__Filter_5" | | | | | | } | | | | | | inputVar: __Project_4 | | | | | | condition: (n.account.accountUuid==$p0) | | | | | | isStable: false | -----+----------------+--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------ | 8 | AppendVertices | 1 | ver: 0, rows: 0, execTime: 12us, totalTime: 14us | outputVar: { | | | | | | "colNames": [ | | | | | | "n" | | | | | | ], | | | | | | "type": "DATASET", | | | | | | "name": "__Project_4" | | | | | | } | | | | | | inputVar: __IndexScan_1 | | | | | | space: 1 | | | | | | dedup: true | | | | | | limit: -1 | | | | | | filter: account._tag IS NOT EMPTY | | | | | | orderBy: [] | | | | | | src: $_vid | | | | | | props: [ | | | | | | { | | | | | | "props": [ | | | | | | "token", | | | | | | "_tag" | | | | | | ], | | | | | | "tagId": 5 | | | | | | }, | | | | | | { | | | | | | "props": [ | | | | | | "accountUuid", | | | | | | "create_time", | | | | | | "_tag" | | | | | | ], | | | | | | "tagId": 2 | | | | | | }, | | | | | | { | | | | | | "props": [ | | | | | | "accountUuid", | | | | | | "createTime", | | | | | | "_tag" | | | | | | ], | | | | | | "tagId": 13 | | | | | | } | | | | | | ] | | | | | | exprs: | | | | | | vertex_filter: | | | | | | if_track_previous_path: false | -----+----------------+--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------ | 1 | IndexScan | 2 | { | outputVar: { | | | | | ver: 0, rows: 0, execTime: 0us, totalTime: 1038us | "colNames": [ | | | | | storage_detail: {IndexLimitNode(limit=9223372036854775807):145(us),IndexProjectionNode(projectColumn=[_vid]):145(us),IndexVertexScanNode(IndexID=14, Path=()):148(us)} | "_vid" | | | | | "127.0.0.1":9779 exec/total: 219(us)/922(us) | ], | | | | | } | "type": "DATASET", | | | | | | "name": "__IndexScan_1" | | | | | | } | | | | | | inputVar: | | | | | | space: 1 | | | | | | dedup: false | | | | | | limit: 9223372036854775807 | | | | | | filter: | | | | | | orderBy: [] | | | | | | schemaId: 13 | | | | | | isEdge: false | | | | | | returnCols: [ | | | | | | "_vid" | | | | | | ] | | | | | | indexCtx: [ | | | | | | { | | | | | | "columnHints": [], | | | | | | "filter": "", | | | | | | "index_id": 14 | | | | | | } | | | | | | ] | -----+----------------+--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------ | 2 | Start | | ver: 0, rows: 0, execTime: 0us, totalTime: 28us | outputVar: { | | | | | | "colNames": [], | | | | | | "type": "DATASET", | | | | | | "name": "__Start_2" | | | | | | } | -----+----------------+--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------ Wed, 02 Nov 2022 07:58:27 EDT
能看下 索引的 rebuild job 成功了么?
profile
(root@nebula) [userProfile]> show jobs +--------+---------------------+------------+----------------------------+----------------------------+ | Job Id | Command | Status | Start Time | Stop Time | +--------+---------------------+------------+----------------------------+----------------------------+ | 9 | "REBUILD_TAG_INDEX" | "FINISHED" | 2022-11-02T09:14:29.000000 | 2022-11-02T09:14:30.000000 | | 8 | "REBUILD_TAG_INDEX" | "FINISHED" | 2022-11-02T09:13:05.000000 | 2022-11-02T09:13:06.000000 | | 7 | "REBUILD_TAG_INDEX" | "FINISHED" | 2022-11-02T08:43:22.000000 | 2022-11-02T08:43:23.000000 | +--------+---------------------+------------+----------------------------+----------------------------+ Got 3 rows (time spent 1580/2380 us)
除了所以呢返回 row 0 的问题 这里还有一个 column hint 的问题,您能用刚发布的 3.3.0 测试一下么?替换二进制重启就行,麻烦也帮忙 profile 一下
另外,帮忙
YIELD $p0
一下
除了所以呢返回 row 0 的问题 这里还有一个 column hint 的问题,您能用刚发布的 3.3.0 测试一下么?替换二进制重启就行,麻烦也帮忙 profile 一下
console还是nebula?
除了所以呢返回 row 0 的问题 这里还有一个 column hint 的问题,您能用刚发布的 3.3.0 测试一下么?替换二进制重启就行,麻烦也帮忙 profile 一下
console还是nebula?
NebulaGraph 内核
[root@localhost ~]# sudo rpm -Uvh nebula-graph-3.3.0.el7.x86_64.rpm
Preparing... ################################# [100%]
Updating / installing...
1:nebula-graph-3.3.0-1 ################################# [ 50%]
Cleaning up / removing...
2:nebula-graph-3.2.0-1 ################################# [100%]
> profile MATCH (n: account) WHERE n.account.accountUuid == $p0 RETURN n;
(root@nebula) [userProfile]> profile MATCH (n: account) WHERE n.account.accountUuid == $p0 RETURN n;
+---+
| n |
+---+
+---+
Empty set (time spent 2355/2783 us)
Execution Plan (optimize time 123 us)
-----+----------------+--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------
| id | name | dependencies | profiling data | operator info |
-----+----------------+--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------
| 6 | Project | 5 | ver: 0, rows: 0, execTime: 11us, totalTime: 13us | outputVar: { |
| | | | | "colNames": [ |
| | | | | "n" |
| | | | | ], |
| | | | | "type": "DATASET", |
| | | | | "name": "__Project_6" |
| | | | | } |
| | | | | inputVar: __Filter_5 |
| | | | | columns: [ |
| | | | | "$n" |
| | | | | ] |
-----+----------------+--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------
| 5 | Filter | 8 | ver: 0, rows: 0, execTime: 8us, totalTime: 11us | outputVar: { |
| | | | | "colNames": [ |
| | | | | "n" |
| | | | | ], |
| | | | | "type": "DATASET", |
| | | | | "name": "__Filter_5" |
| | | | | } |
| | | | | inputVar: __Project_4 |
| | | | | condition: (n.account.accountUuid==$p0) |
| | | | | isStable: false |
-----+----------------+--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------
| 8 | AppendVertices | 1 | ver: 0, rows: 0, execTime: 35us, totalTime: 41us | outputVar: { |
| | | | | "colNames": [ |
| | | | | "n" |
| | | | | ], |
| | | | | "type": "DATASET", |
| | | | | "name": "__Project_4" |
| | | | | } |
| | | | | inputVar: __IndexScan_1 |
| | | | | space: 1 |
| | | | | dedup: true |
| | | | | limit: -1 |
| | | | | filter: account._tag IS NOT EMPTY |
| | | | | orderBy: [] |
| | | | | src: $_vid |
| | | | | props: [ |
| | | | | { |
| | | | | "props": [ |
| | | | | "accountUuid", |
| | | | | "createTime", |
| | | | | "_tag" |
| | | | | ], |
| | | | | "tagId": 13 |
| | | | | }, |
| | | | | { |
| | | | | "props": [ |
| | | | | "token", |
| | | | | "_tag" |
| | | | | ], |
| | | | | "tagId": 5 |
| | | | | }, |
| | | | | { |
| | | | | "props": [ |
| | | | | "accountUuid", |
| | | | | "create_time", |
| | | | | "_tag" |
| | | | | ], |
| | | | | "tagId": 2 |
| | | | | } |
| | | | | ] |
| | | | | exprs: |
| | | | | vertex_filter: |
| | | | | if_track_previous_path: false |
-----+----------------+--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------
| 1 | IndexScan | 2 | { | outputVar: { |
| | | | ver: 0, rows: 0, execTime: 0us, totalTime: 1455us | "colNames": [ |
| | | | storage_detail: {IndexLimitNode(limit=9223372036854775807):152(us),IndexProjectionNode(projectColumn=[_vid]):150(us),IndexVertexScanNode(IndexID=14, Path=()):151(us)} | "_vid" |
| | | | "127.0.0.1":9779 exec/total: 279(us)/1308(us) | ], |
| | | | } | "type": "DATASET", |
| | | | | "name": "__IndexScan_1" |
| | | | | } |
| | | | | inputVar: |
| | | | | space: 1 |
| | | | | dedup: false |
| | | | | limit: 9223372036854775807 |
| | | | | filter: |
| | | | | orderBy: [] |
| | | | | schemaId: 13 |
| | | | | isEdge: false |
| | | | | returnCols: [ |
| | | | | "_vid" |
| | | | | ] |
| | | | | indexCtx: [ |
| | | | | { |
| | | | | "columnHints": [], |
| | | | | "filter": "", |
| | | | | "index_id": 14 |
| | | | | } |
| | | | | ] |
-----+----------------+--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------
| 2 | Start | | ver: 0, rows: 0, execTime: 0us, totalTime: 20us | outputVar: { |
| | | | | "colNames": [], |
| | | | | "type": "DATASET", |
| | | | | "name": "__Start_2" |
| | | | | } |
-----+----------------+--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------
Wed, 02 Nov 2022 08:16:05 EDT
再确认一下 YIELD $p0 是有东西的哈?
这里应该有两个问题,索引没数据+优化没走 columnHint。
第一个问题现在不知道是什么情况,请问 profile MATCH (n: account) WHERE n.account.accountUuid == "account001" RETURN n;
能发一下么?
第二个问题一会儿我去提一个 issue 哈
profile MATCH (n: account) WHERE n.account.accountUuid == "account001" RETURN n
(root@nebula) [userProfile]> YIELD $p0 +--------------+ | $p0 | +--------------+ | "account001" | +--------------+ Got 1 rows (time spent 661/1620 us)
Wed, 02 Nov 2022 10:10:29 EDT
(root@nebula) [userProfile]> profile MATCH (n: account) WHERE n.account.accountUuid == "account001" RETURN n +----------------------------------------------------------------------------+ | n | +----------------------------------------------------------------------------+ | ("account001" :account{accountUuid: "account001", createTime: 1665368723}) | +----------------------------------------------------------------------------+ Got 1 rows (time spent 4284/4843 us)
Execution Plan (optimize time 200 us)
-----+----------------+--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------- | id | name | dependencies | profiling data | operator info | -----+----------------+--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------- | 6 | Project | 5 | ver: 0, rows: 1, execTime: 68us, totalTime: 69us | outputVar: { | | | | | | "colNames": [ | | | | | | "n" | | | | | | ], | | | | | | "type": "DATASET", | | | | | | "name": "Project_6" | | | | | | } | | | | | | inputVar: __Filter_5 | | | | | | columns: [ | | | | | | "$n" | | | | | | ] | -----+----------------+--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------- | 5 | Filter | 9 | ver: 0, rows: 1, execTime: 17us, totalTime: 18us | outputVar: { | | | | | | "colNames": [ | | | | | | "n" | | | | | | ], | | | | | | "type": "DATASET", | | | | | | "name": "Filter_5" | | | | | | } | | | | | | inputVar: Project_4 | | | | | | condition: (n.account.accountUuid=="account001") | | | | | | isStable: false | -----+----------------+--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------- | 9 | AppendVertices | 7 | { | outputVar: { | | | | | ver: 0, rows: 1, execTime: 151us, totalTime: 845us | "colNames": [ | | | | | total_rpc: 762(us) | "n" | | | | | "127.0.0.1":9779 exec/total: 243(us)/688(us) | ], | | | | | } | "type": "DATASET", | | | | | | "name": "Project_4" | | | | | | } | | | | | | inputVar: IndexScan_1 | | | | | | space: 1 | | | | | | dedup: true | | | | | | limit: -1 | | | | | | filter: account._tag IS NOT EMPTY | | | | | | orderBy: [] | | | | | | src: $_vid | | | | | | props: [ | | | | | | { | | | | | | "props": [ | | | | | | "accountUuid", | | | | | | "createTime", | | | | | | "_tag" | | | | | | ], | | | | | | "tagId": 13 | | | | | | }, | | | | | | { | | | | | | "props": [ | | | | | | "token", | | | | | | "_tag" | | | | | | ], | | | | | | "tagId": 5 | | | | | | }, | | | | | | { | | | | | | "props": [ | | | | | | "accountUuid", | | | | | | "create_time", | | | | | | "_tag" | | | | | | ], | | | | | | "tagId": 2 | | | | | | } | | | | | | ] | | | | | | exprs: | | | | | | vertex_filter: | | | | | | if_track_previous_path: false | -----+----------------+--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------- | 7 | IndexScan | 2 | { | outputVar: { | | | | | ver: 0, rows: 1, execTime: 0us, totalTime: 1433us | "colNames": [ | | | | | storage_detail: {IndexLimitNode(limit=9223372036854775807):267(us),IndexProjectionNode(projectColumn=[_vid]):264(us),IndexVertexScanNode(IndexID=15, Path=(accountUuid="account001", )):268(us)} | "_vid" | | | | | "127.0.0.1":9779 exec/total: 512(us)/1312(us) | ], | | | | | } | "type": "DATASET", | | | | | | "name": "IndexScan_1" | | | | | | } | | | | | | inputVar: | | | | | | space: 1 | | | | | | dedup: false | | | | | | limit: 9223372036854775807 | | | | | | filter: | | | | | | orderBy: [] | | | | | | schemaId: 13 | | | | | | isEdge: false | | | | | | returnCols: [ | | | | | | "_vid" | | | | | | ] | | | | | | indexCtx: [ | | | | | | { | | | | | | "columnHints": [ | | | | | | { | | | | | | "includeEnd": false, | | | | | | "includeBegin": true, | | | | | | "endValue": "EMPTY", | | | | | | "beginValue": "account001", | | | | | | "scanType": "PREFIX", | | | | | | "column": "accountUuid" | | | | | | } | | | | | | ], | | | | | | "filter": "", | | | | | | "index_id": 15 | | | | | | } | | | | | | ] | -----+----------------+--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------- | 2 | Start | | ver: 0, rows: 0, execTime: 2us, totalTime: 24us | outputVar: { | | | | | | "colNames": [], | | | | | | "type": "DATASET", | | | | | | "name": "__Start_2" | | | | | | } | -----+----------------+--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------
Wed, 02 Nov 2022 10:10:39 EDT
我知道了,你有多个索引,索引选择有点问题(问题2),错误的索引没rebuild造成了 row 0 (问题1)
帮看看所有的索引吧,和这个tag 有关的
总结:
总结:
- [x] 问题1,麻烦 @llinzhe 帮忙看下,应该是有多个索引,错误选择的索引 2 没有rebuild
- [ ] 问题2,优化器的索引选择有问题,没能下推属性过滤,已经报告在 opt: param indexScan columnHint/prefix scan vesoft-inc/nebula#4820
ok, 另一个索引 rebuild 一下,是可以出结果的,不过,现在的查询不是最优的,因为走了 index 的全扫描。
在这些优化有了之前,先手攒 query 里的参数为 query string 直接发吧,不用 cypher parameter。
ok, 另一个索引 rebuild 一下,是可以出结果的,不过,现在的查询不是最优的,因为走了 index 的全扫描。
在这些优化有了之前,先手攒 query 里的参数为 query string 直接发吧,不用 cypher parameter。
(root@nebula) [userProfile]> rebuild tag index accountIndex +------------+ | New Job Id | +------------+ | 10 | +------------+ Got 1 rows (time spent 1674/2119 us)
Wed, 02 Nov 2022 22:28:14 EDT
(root@nebula) [userProfile]> show jobs +--------+---------------------+------------+----------------------------+----------------------------+ | Job Id | Command | Status | Start Time | Stop Time | +--------+---------------------+------------+----------------------------+----------------------------+ | 10 | "REBUILD_TAG_INDEX" | "FINISHED" | 2022-11-03T02:28:14.000000 | 2022-11-03T02:28:15.000000 | | 9 | "REBUILD_TAG_INDEX" | "FINISHED" | 2022-11-02T09:14:29.000000 | 2022-11-02T09:14:30.000000 | | 8 | "REBUILD_TAG_INDEX" | "FINISHED" | 2022-11-02T09:13:05.000000 | 2022-11-02T09:13:06.000000 | | 7 | "REBUILD_TAG_INDEX" | "FINISHED" | 2022-11-02T08:43:22.000000 | 2022-11-02T08:43:23.000000 | +--------+---------------------+------------+----------------------------+----------------------------+ Got 4 rows (time spent 1124/2006 us)
Wed, 02 Nov 2022 22:28:19 EDT
(root@nebula) [userProfile]> :param p0 => 'account001'; (root@nebula) [userProfile]> MATCH (n: account) WHERE n.account.accountUuid == $p0 RETURN n; +----------------------------------------------------------------------------+ | n | +----------------------------------------------------------------------------+ | ("account001" :account{accountUuid: "account001", createTime: 1665368723}) | +----------------------------------------------------------------------------+ Got 1 rows (time spent 3004/3563 us)
Wed, 02 Nov 2022 22:29:08 EDT
rebuild后可以查出来了~
ok, 另一个索引 rebuild 一下,是可以出结果的,不过,现在的查询不是最优的,因为走了 index 的全扫描。
ngbatis内置了一些不需要开发者写nGQL的接口,是否有必要让内部人员协助将最优的查询方式固化到ngbatis当中。
(root@nebula) [userProfile]> MATCH (n1: account)-[r: login*2]-( n2: account) WHERE n1.account.accountUuid == 'account001' RETURN n2.account.accountUuid as accountUuid +--------------+ | accountUuid | +--------------+ | "account003" | +--------------+ Got 1 rows (time spent 3191/3710 us)
- nGql:USE userProfile;
MATCH (n1: account)-[r: login*2]-(n2: account)
WHERE n1.account.accountUuid == 'account001'
RETURN n2.account.accountUuid as accountUuid
- params: {p0=account001}
- result:ColumnName: [accountUuid], Rows: []
@wey-gu @CorvusYe 大佬们帮忙看看这个也是索引下推的问题?
ok, 另一个索引 rebuild 一下,是可以出结果的,不过,现在的查询不是最优的,因为走了 index 的全扫描。
ngbatis内置了一些不需要开发者写nGQL的接口,是否有必要让内部人员协助将最优的查询方式固化到ngbatis当中。
可以创建一些 review task 在 issue 上,指明要看的 query 路径,我来做哈。
nebula-console
(root@nebula) [userProfile]> MATCH (n1: account)-[r: login*2]-( n2: account) WHERE n1.account.accountUuid == 'account001' RETURN n2.account.accountUuid as accountUuid +--------------+ | accountUuid | +--------------+ | "account003" | +--------------+ Got 1 rows (time spent 3191/3710 us)
ngbatis
- nGql:USE userProfile; MATCH (n1: account)-[r: login*2]-(n2: account) WHERE n1.account.accountUuid == 'account001' RETURN n2.account.accountUuid as accountUuid - params: {p0=account001} - result:ColumnName: [accountUuid], Rows: []
@wey-gu @CorvusYe 大佬们帮忙看看这个也是索引下推的问题?
可以把带有参数,不带参数的 profile 比较一下么?一般来说没有结果的都是走到了未 rebuild 的索引上
> > # nebula-console
> > (root@nebula) [userProfile]> MATCH (n1: account)-[r: login*2]-( n2: account) WHERE n1.account.accountUuid == 'account001' RETURN n2.account.accountUuid as accountUuid +--------------+ | accountUuid | +--------------+ | "account003" | +--------------+ Got 1 rows (time spent 3191/3710 us)
> > # ngbatis
> > ```
> > - nGql:USE userProfile;
> > MATCH (n1: account)-[r: login*2]-(n2: account)
> > WHERE n1.account.accountUuid == 'account001'
> > RETURN n2.account.accountUuid as accountUuid
> > - params: {p0=account001}
> > - result:ColumnName: [accountUuid], Rows: []
> > ```
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > @wey-gu @CorvusYe 大佬们帮忙看看这个也是索引下推的问题?
>
> 可以把带有参数,不带参数的 profile 比较一下么?一般来说没有结果的都是走到了未 rebuild 的索引上
(root@nebula) [userProfile]> profile MATCH (n1: account)-[r: login*2]-( n2: account) WHERE n1.account.accountUuid == 'account001' RETURN n2.account.accountUuid as accountUuid
+--------------+
| accountUuid |
+--------------+
| "account003" |
+--------------+
Got 1 rows (time spent 3740/4285 us)
Execution Plan (optimize time 234 us)
-----+----------------+--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------
| id | name | dependencies | profiling data | operator info |
-----+----------------+--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------
| 13 | Project | 9 | ver: 0, rows: 1, execTime: 7us, totalTime: 7us | outputVar: { |
| | | | | "colNames": [ |
| | | | | "accountUuid" |
| | | | | ], |
| | | | | "type": "DATASET", |
| | | | | "name": "__Project_7" |
| | | | | } |
| | | | | inputVar: __Filter_9 |
| | | | | columns: [ |
| | | | | "-.n2.account.accountUuid" |
| | | | | ] |
-----+----------------+--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------
| 9 | Filter | 12 | ver: 0, rows: 1, execTime: 7us, totalTime: 8us | outputVar: { |
| | | | | "colNames": [ |
| | | | | "n1", |
| | | | | "r", |
| | | | | "n2" |
| | | | | ], |
| | | | | "type": "DATASET", |
| | | | | "name": "__Filter_9" |
| | | | | } |
| | | | | inputVar: __AppendVertices_4 |
| | | | | condition: (-.n1.account.accountUuid=="account001") |
| | | | | isStable: false |
-----+----------------+--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------
| 12 | AppendVertices | 11 | { | outputVar: { |
| | | | ver: 0, rows: 1, execTime: 93us, totalTime: 499us | "colNames": [ |
| | | | "127.0.0.1":9779 exec/total: 58(us)/380(us) | "n1", |
| | | | total_rpc: 438(us) | "r", |
| | | | } | "n2" |
| | | | | ], |
| | | | | "type": "DATASET", |
| | | | | "name": "__AppendVertices_4" |
| | | | | } |
| | | | | inputVar: __Traverse_3 |
| | | | | space: 1 |
| | | | | dedup: true |
| | | | | limit: -1 |
| | | | | filter: account._tag IS NOT EMPTY |
| | | | | orderBy: [] |
| | | | | src: none_direct_dst($-.r) |
| | | | | props: [ |
| | | | | { |
| | | | | "props": [ |
| | | | | "accountUuid", |
| | | | | "_tag" |
| | | | | ], |
| | | | | "tagId": 13 |
| | | | | } |
| | | | | ] |
| | | | | exprs: |
| | | | | vertex_filter: |
| | | | | if_track_previous_path: true |
-----+----------------+--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------
| 11 | Traverse | 8 | { | outputVar: { |
| | | | ver: 0, rows: 1, execTime: 123us, totalTime: 1108us | "colNames": [ |
| | | | step 2: { | "n1", |
| | | | {"127.0.0.1":9779 exec/total/vertices: 161(us)/466(us)/2, | "r" |
| | | | total_rpc_time: 496(us) | ], |
| | | | storage_detail: {GetNeighborsNode:121(us),HashJoinNode:113(us),RelNode:121(us),SingleEdgeNode:51(us),TagNode:59(us)} | "type": "DATASET", |
| | | | } | "name": "__Traverse_3" |
| | | | } | } |
| | | | step 1: { | inputVar: __IndexScan_1 |
| | | | {"127.0.0.1":9779 exec/total/vertices: 172(us)/441(us)/1, | space: 1 |
| | | | total_rpc_time: 501(us) | dedup: true |
| | | | storage_detail: {FilterNode:79(us),GetNeighborsNode:86(us),HashJoinNode:76(us),RelNode:86(us),SingleEdgeNode:34(us),TagNode:34(us)} | limit: -1 |
| | | | } | filter: |
| | | | } | orderBy: [] |
| | | | } | src: $_vid |
| | | | | edgeTypes: [] |
| | | | | edgeDirection: BOTH |
| | | | | vertexProps: [ |
| | | | | { |
| | | | | "props": [ |
| | | | | "accountUuid" |
| | | | | ], |
| | | | | "tagId": 13 |
| | | | | } |
| | | | | ] |
| | | | | edgeProps: [ |
| | | | | { |
| | | | | "props": [ |
| | | | | "_dst", |
| | | | | "_type", |
| | | | | "_rank" |
| | | | | ], |
| | | | | "type": -16 |
| | | | | }, |
| | | | | { |
| | | | | "props": [ |
| | | | | "_dst", |
| | | | | "_type", |
| | | | | "_rank" |
| | | | | ], |
| | | | | "type": 16 |
| | | | | } |
| | | | | ] |
| | | | | statProps: |
| | | | | exprs: |
| | | | | random: false |
| | | | | steps: 2..2 |
| | | | | vertex filter: |
| | | | | edge filter: |
| | | | | if_track_previous_path: false |
| | | | | first step filter: account._tag IS NOT EMPTY |
-----+----------------+--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------
| 8 | IndexScan | 2 | { | outputVar: { |
| | | | ver: 0, rows: 1, execTime: 0us, totalTime: 862us | "colNames": [ |
| | | | "127.0.0.1":9779 exec/total: 305(us)/740(us) | "_vid" |
| | | | storage_detail: {IndexLimitNode(limit=9223372036854775807):204(us),IndexProjectionNode(projectColumn=[_vid]):204(us),IndexVertexScanNode(IndexID=15, Path=(accountUuid="account001", )):210(us)} | ], |
| | | | } | "type": "DATASET", |
| | | | | "name": "__IndexScan_1" |
| | | | | } |
| | | | | inputVar: |
| | | | | space: 1 |
| | | | | dedup: false |
| | | | | limit: 9223372036854775807 |
| | | | | filter: |
| | | | | orderBy: [] |
| | | | | schemaId: 13 |
| | | | | isEdge: false |
| | | | | returnCols: [ |
| | | | | "_vid" |
| | | | | ] |
| | | | | indexCtx: [ |
| | | | | { |
| | | | | "columnHints": [ |
| | | | | { |
| | | | | "includeEnd": false, |
| | | | | "includeBegin": true, |
| | | | | "endValue": "__EMPTY__", |
| | | | | "beginValue": "account001", |
| | | | | "scanType": "PREFIX", |
| | | | | "column": "accountUuid" |
| | | | | } |
| | | | | ], |
| | | | | "filter": "", |
| | | | | "index_id": 15 |
| | | | | } |
| | | | | ] |
-----+----------------+--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------
| 2 | Start | | ver: 0, rows: 0, execTime: 0us, totalTime: 24us | outputVar: { |
| | | | | "colNames": [], |
| | | | | "type": "DATASET", |
| | | | | "name": "__Start_2" |
| | | | | } |
-----+----------------+--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------
Mon, 07 Nov 2022 02:18:05 EST
(root@nebula) [userProfile]> profile MATCH (n1: account)-[r: login*2]-( n2: account) \
-> WHERE n1.account.accountUuid == '${p0}' \
-> RETURN n2.account.accountUuid as accountUuid
+-------------+
| accountUuid |
+-------------+
+-------------+
Empty set (time spent 1727/2296 us)
Execution Plan (optimize time 238 us)
-----+----------------+--------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------
| id | name | dependencies | profiling data | operator info |
-----+----------------+--------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------
| 13 | Project | 9 | ver: 0, rows: 0, execTime: 19us, totalTime: 21us | outputVar: { |
| | | | | "colNames": [ |
| | | | | "accountUuid" |
| | | | | ], |
| | | | | "type": "DATASET", |
| | | | | "name": "__Project_7" |
| | | | | } |
| | | | | inputVar: __Filter_9 |
| | | | | columns: [ |
| | | | | "-.n2.account.accountUuid" |
| | | | | ] |
-----+----------------+--------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------
| 9 | Filter | 12 | ver: 0, rows: 0, execTime: 3us, totalTime: 3us | outputVar: { |
| | | | | "colNames": [ |
| | | | | "n1", |
| | | | | "r", |
| | | | | "n2" |
| | | | | ], |
| | | | | "type": "DATASET", |
| | | | | "name": "__Filter_9" |
| | | | | } |
| | | | | inputVar: __AppendVertices_4 |
| | | | | condition: (-.n1.account.accountUuid=="${p0}") |
| | | | | isStable: false |
-----+----------------+--------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------
| 12 | AppendVertices | 11 | ver: 0, rows: 0, execTime: 7us, totalTime: 9us | outputVar: { |
| | | | | "colNames": [ |
| | | | | "n1", |
| | | | | "r", |
| | | | | "n2" |
| | | | | ], |
| | | | | "type": "DATASET", |
| | | | | "name": "__AppendVertices_4" |
| | | | | } |
| | | | | inputVar: __Traverse_3 |
| | | | | space: 1 |
| | | | | dedup: true |
| | | | | limit: -1 |
| | | | | filter: account._tag IS NOT EMPTY |
| | | | | orderBy: [] |
| | | | | src: none_direct_dst($-.r) |
| | | | | props: [ |
| | | | | { |
| | | | | "props": [ |
| | | | | "accountUuid", |
| | | | | "_tag" |
| | | | | ], |
| | | | | "tagId": 13 |
| | | | | } |
| | | | | ] |
| | | | | exprs: |
| | | | | vertex_filter: |
| | | | | if_track_previous_path: true |
-----+----------------+--------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------
| 11 | Traverse | 8 | ver: 0, rows: 0, execTime: 5us, totalTime: 22us | outputVar: { |
| | | | | "colNames": [ |
| | | | | "n1", |
| | | | | "r" |
| | | | | ], |
| | | | | "type": "DATASET", |
| | | | | "name": "__Traverse_3" |
| | | | | } |
| | | | | inputVar: __IndexScan_1 |
| | | | | space: 1 |
| | | | | dedup: true |
| | | | | limit: -1 |
| | | | | filter: |
| | | | | orderBy: [] |
| | | | | src: $_vid |
| | | | | edgeTypes: [] |
| | | | | edgeDirection: BOTH |
| | | | | vertexProps: [ |
| | | | | { |
| | | | | "props": [ |
| | | | | "accountUuid" |
| | | | | ], |
| | | | | "tagId": 13 |
| | | | | } |
| | | | | ] |
| | | | | edgeProps: [ |
| | | | | { |
| | | | | "props": [ |
| | | | | "_dst", |
| | | | | "_type", |
| | | | | "_rank" |
| | | | | ], |
| | | | | "type": -16 |
| | | | | }, |
| | | | | { |
| | | | | "props": [ |
| | | | | "_dst", |
| | | | | "_type", |
| | | | | "_rank" |
| | | | | ], |
| | | | | "type": 16 |
| | | | | } |
| | | | | ] |
| | | | | statProps: |
| | | | | exprs: |
| | | | | random: false |
| | | | | steps: 2..2 |
| | | | | vertex filter: |
| | | | | edge filter: |
| | | | | if_track_previous_path: false |
| | | | | first step filter: account._tag IS NOT EMPTY |
-----+----------------+--------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------
| 8 | IndexScan | 2 | { | outputVar: { |
| | | | ver: 0, rows: 0, execTime: 0us, totalTime: 812us | "colNames": [ |
| | | | storage_detail: {IndexLimitNode(limit=9223372036854775807):152(us),IndexProjectionNode(projectColumn=[_vid]):146(us),IndexVertexScanNode(IndexID=15, Path=(accountUuid="${p0}", )):165(us)} | "_vid" |
| | | | "127.0.0.1":9779 exec/total: 243(us)/749(us) | ], |
| | | | } | "type": "DATASET", |
| | | | | "name": "__IndexScan_1" |
| | | | | } |
| | | | | inputVar: |
| | | | | space: 1 |
| | | | | dedup: false |
| | | | | limit: 9223372036854775807 |
| | | | | filter: |
| | | | | orderBy: [] |
| | | | | schemaId: 13 |
| | | | | isEdge: false |
| | | | | returnCols: [ |
| | | | | "_vid" |
| | | | | ] |
| | | | | indexCtx: [ |
| | | | | { |
| | | | | "columnHints": [ |
| | | | | { |
| | | | | "includeEnd": false, |
| | | | | "includeBegin": true, |
| | | | | "endValue": "__EMPTY__", |
| | | | | "beginValue": "${p0}", |
| | | | | "scanType": "PREFIX", |
| | | | | "column": "accountUuid" |
| | | | | } |
| | | | | ], |
| | | | | "filter": "", |
| | | | | "index_id": 15 |
| | | | | } |
| | | | | ] |
-----+----------------+--------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------
| 2 | Start | | ver: 0, rows: 0, execTime: 0us, totalTime: 18us | outputVar: { |
| | | | | "colNames": [], |
| | | | | "type": "DATASET", |
| | | | | "name": "__Start_2" |
| | | | | } |
-----+----------------+--------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------
Mon, 07 Nov 2022 02:20:06 EST
建议用 Markdown 的 code block 包裹哈,前边的都是我给你编辑的
(root@nebula) [userProfile]> profile MATCH (n1: account)-[r: login*2]-( n2: account) -> WHERE n1.account.accountUuid == '${p0}' -> RETURN n2.account.accountUuid as accountUuid
这个query 写的不对哈,应该是 WHERE n1.account.accountUuid == $p0
这个也是不行,查到为空
(root@nebula) [userProfile]> profile MATCH (n1: account)-[r: login*2]-( n2: account) -> WHERE n1.account.accountUuid == '${p0}' -> RETURN n2.account.accountUuid as accountUuid
这个query 写的不对哈,应该是
WHERE n1.account.accountUuid == $p0
(root@nebula) [userProfile]> profile MATCH (n1: account)-[r: login*2]-( n2: account) WHERE n1.account.accountUuid == $p0 RETURN n2.account.accountUuid as accountUuid
+-------------+
| accountUuid |
+-------------+
+-------------+
Empty set (time spent 3428/4001 us)
Execution Plan (optimize time 211 us)
-----+----------------+--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------
| id | name | dependencies | profiling data | operator info |
-----+----------------+--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------
| 12 | Project | 8 | ver: 0, rows: 0, execTime: 7us, totalTime: 8us | outputVar: { |
| | | | | "colNames": [ |
| | | | | "accountUuid" |
| | | | | ], |
| | | | | "type": "DATASET", |
| | | | | "name": "__Project_7" |
| | | | | } |
| | | | | inputVar: __Filter_8 |
| | | | | columns: [ |
| | | | | "-.n2.account.accountUuid" |
| | | | | ] |
-----+----------------+--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------
| 8 | Filter | 11 | ver: 0, rows: 0, execTime: 9us, totalTime: 10us | outputVar: { |
| | | | | "colNames": [ |
| | | | | "n1", |
| | | | | "r", |
| | | | | "n2" |
| | | | | ], |
| | | | | "type": "DATASET", |
| | | | | "name": "__Filter_8" |
| | | | | } |
| | | | | inputVar: __AppendVertices_4 |
| | | | | condition: (-.n1.account.accountUuid==$p0) |
| | | | | isStable: false |
-----+----------------+--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------
| 11 | AppendVertices | 10 | { | outputVar: { |
| | | | ver: 0, rows: 2, execTime: 100us, totalTime: 505us | "colNames": [ |
| | | | "127.0.0.1":9779 exec/total: 74(us)/374(us) | "n1", |
| | | | total_rpc: 418(us) | "r", |
| | | | } | "n2" |
| | | | | ], |
| | | | | "type": "DATASET", |
| | | | | "name": "__AppendVertices_4" |
| | | | | } |
| | | | | inputVar: __Traverse_3 |
| | | | | space: 1 |
| | | | | dedup: true |
| | | | | limit: -1 |
| | | | | filter: account._tag IS NOT EMPTY |
| | | | | orderBy: [] |
| | | | | src: none_direct_dst($-.r) |
| | | | | props: [ |
| | | | | { |
| | | | | "props": [ |
| | | | | "accountUuid", |
| | | | | "_tag" |
| | | | | ], |
| | | | | "tagId": 13 |
| | | | | } |
| | | | | ] |
| | | | | exprs: |
| | | | | vertex_filter: |
| | | | | if_track_previous_path: true |
-----+----------------+--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------
| 10 | Traverse | 1 | { | outputVar: { |
| | | | ver: 0, rows: 2, execTime: 151us, totalTime: 1238us | "colNames": [ |
| | | | step 2: { | "n1", |
| | | | {"127.0.0.1":9779 exec/total/vertices: 130(us)/452(us)/2, | "r" |
| | | | total_rpc_time: 494(us) | ], |
| | | | storage_detail: {GetNeighborsNode:87(us),HashJoinNode:79(us),RelNode:87(us),SingleEdgeNode:49(us),TagNode:28(us)} | "type": "DATASET", |
| | | | } | "name": "__Traverse_3" |
| | | | } | } |
| | | | step 1: { | inputVar: __IndexScan_1 |
| | | | {"127.0.0.1":9779 exec/total/vertices: 205(us)/538(us)/2, | space: 1 |
| | | | total_rpc_time: 615(us) | dedup: true |
| | | | storage_detail: {FilterNode:109(us),GetNeighborsNode:119(us),HashJoinNode:105(us),RelNode:120(us),SingleEdgeNode:54(us),TagNode:30(us)} | limit: -1 |
| | | | } | filter: |
| | | | } | orderBy: [] |
| | | | } | src: $_vid |
| | | | | edgeTypes: [] |
| | | | | edgeDirection: BOTH |
| | | | | vertexProps: [ |
| | | | | { |
| | | | | "props": [ |
| | | | | "accountUuid" |
| | | | | ], |
| | | | | "tagId": 13 |
| | | | | } |
| | | | | ] |
| | | | | edgeProps: [ |
| | | | | { |
| | | | | "props": [ |
| | | | | "_dst", |
| | | | | "_type", |
| | | | | "_rank" |
| | | | | ], |
| | | | | "type": -16 |
| | | | | }, |
| | | | | { |
| | | | | "props": [ |
| | | | | "_dst", |
| | | | | "_type", |
| | | | | "_rank" |
| | | | | ], |
| | | | | "type": 16 |
| | | | | } |
| | | | | ] |
| | | | | statProps: |
| | | | | exprs: |
| | | | | random: false |
| | | | | steps: 2..2 |
| | | | | vertex filter: |
| | | | | edge filter: |
| | | | | if_track_previous_path: false |
| | | | | first step filter: account._tag IS NOT EMPTY |
-----+----------------+--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------
| 1 | IndexScan | 2 | { | outputVar: { |
| | | | ver: 0, rows: 2, execTime: 0us, totalTime: 835us | "colNames": [ |
| | | | storage_detail: {IndexLimitNode(limit=9223372036854775807):173(us),IndexProjectionNode(projectColumn=[_vid]):173(us),IndexVertexScanNode(IndexID=15, Path=()):176(us)} | "_vid" |
| | | | "127.0.0.1":9779 exec/total: 273(us)/742(us) | ], |
| | | | } | "type": "DATASET", |
| | | | | "name": "__IndexScan_1" |
| | | | | } |
| | | | | inputVar: |
| | | | | space: 1 |
| | | | | dedup: false |
| | | | | limit: 9223372036854775807 |
| | | | | filter: |
| | | | | orderBy: [] |
| | | | | schemaId: 13 |
| | | | | isEdge: false |
| | | | | returnCols: [ |
| | | | | "_vid" |
| | | | | ] |
| | | | | indexCtx: [ |
| | | | | { |
| | | | | "columnHints": [], |
| | | | | "filter": "", |
| | | | | "index_id": 15 |
| | | | | } |
| | | | | ] |
-----+----------------+--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------
| 2 | Start | | ver: 0, rows: 0, execTime: 0us, totalTime: 23us | outputVar: { |
| | | | | "colNames": [], |
| | | | | "type": "DATASET", |
| | | | | "name": "__Start_2" |
| | | | | } |
-----+----------------+--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------
Mon, 07 Nov 2022 02:46:31 EST
(root@nebula) [userProfile]> profile MATCH (n1: account)-[r: login*2]-( n2: account) -> WHERE n1.account.accountUuid == '${p0}' -> RETURN n2.account.accountUuid as accountUuid
这个query 写的不对哈,应该是
WHERE n1.account.accountUuid == $p0
@wey-gu
${p0}
是 ngbatis 的占位符,会直接把 {p0=account001} 中的 account001 替换到 ${p0}
的位置,形成 ‘account001’
:param p0 => 'account001';
nebula-console 执行
(root@nebula) [userProfile]> :param p0 => 'account001'; (root@nebula) [userProfile]> profile MATCH (n1: account)-[r: login*2]-( n2: account) WHERE n1.account.accountUuid ==$p0 RETURN n2.account.accountUuid as accountUuid +--------------+ | accountUuid | +--------------+ | "account003" | +--------------+ Got 1 rows (time spent 3623/4390 us)
Execution Plan (optimize time 236 us)
-----+----------------+--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------- | id | name | dependencies | profiling data | operator info | -----+----------------+--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------- | 12 | Project | 8 | ver: 0, rows: 1, execTime: 34us, totalTime: 36us | outputVar: { | | | | | | "colNames": [ | | | | | | "accountUuid" | | | | | | ], | | | | | | "type": "DATASET", | | | | | | "name": "Project_7" | | | | | | } | | | | | | inputVar: __Filter_8 | | | | | | columns: [ | | | | | | "-.n2.account.accountUuid" | | | | | | ] | -----+----------------+--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------- | 8 | Filter | 11 | ver: 0, rows: 1, execTime: 17us, totalTime: 23us | outputVar: { | | | | | | "colNames": [ | | | | | | "n1", | | | | | | "r", | | | | | | "n2" | | | | | | ], | | | | | | "type": "DATASET", | | | | | | "name": "Filter_8" | | | | | | } | | | | | | inputVar: AppendVertices_4 | | | | | | condition: (-.n1.account.accountUuid==$p0) | | | | | | isStable: false | -----+----------------+--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------- | 11 | AppendVertices | 10 | { | outputVar: { | | | | | ver: 0, rows: 2, execTime: 76us, totalTime: 433us | "colNames": [ | | | | | "127.0.0.1":9779 exec/total: 64(us)/333(us) | "n1", | | | | | total_rpc: 379(us) | "r", | | | | | } | "n2" | | | | | | ], | | | | | | "type": "DATASET", | | | | | | "name": "AppendVertices_4" | | | | | | } | | | | | | inputVar: Traverse_3 | | | | | | space: 1 | | | | | | dedup: true | | | | | | limit: -1 | | | | | | filter: account._tag IS NOT EMPTY | | | | | | orderBy: [] | | | | | | src: none_direct_dst($-.r) | | | | | | props: [ | | | | | | { | | | | | | "props": [ | | | | | | "accountUuid", | | | | | | "_tag" | | | | | | ], | | | | | | "tagId": 13 | | | | | | } | | | | | | ] | | | | | | exprs: | | | | | | vertex_filter: | | | | | | if_track_previous_path: true | -----+----------------+--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------- | 10 | Traverse | 1 | { | outputVar: { | | | | | ver: 0, rows: 2, execTime: 156us, totalTime: 1261us | "colNames": [ | | | | | step 2: { | "n1", | | | | | {"127.0.0.1":9779 exec/total/vertices: 121(us)/468(us)/2, | "r" | | | | | total_rpc_time: 513(us) | ], | | | | | storage_detail: {GetNeighborsNode:90(us),HashJoinNode:83(us),RelNode:90(us),SingleEdgeNode:47(us),TagNode:33(us)} | "type": "DATASET", | | | | | } | "name": "Traverse_3" | | | | | } | } | | | | | step 1: { | inputVar: IndexScan_1 | | | | | {"127.0.0.1":9779 exec/total/vertices: 201(us)/536(us)/2, | space: 1 | | | | | total_rpc_time: 610(us) | dedup: true | | | | | storage_detail: {FilterNode:120(us),GetNeighborsNode:129(us),HashJoinNode:116(us),RelNode:130(us),SingleEdgeNode:64(us),TagNode:42(us)} | limit: -1 | | | | | } | filter: | | | | | } | orderBy: [] | | | | | } | src: $_vid | | | | | | edgeTypes: [] | | | | | | edgeDirection: BOTH | | | | | | vertexProps: [ | | | | | | { | | | | | | "props": [ | | | | | | "accountUuid" | | | | | | ], | | | | | | "tagId": 13 | | | | | | } | | | | | | ] | | | | | | edgeProps: [ | | | | | | { | | | | | | "props": [ | | | | | | "_dst", | | | | | | "_type", | | | | | | "_rank" | | | | | | ], | | | | | | "type": -16 | | | | | | }, | | | | | | { | | | | | | "props": [ | | | | | | "_dst", | | | | | | "_type", | | | | | | "_rank" | | | | | | ], | | | | | | "type": 16 | | | | | | } | | | | | | ] | | | | | | statProps: | | | | | | exprs: | | | | | | random: false | | | | | | steps: 2..2 | | | | | | vertex filter: | | | | | | edge filter: | | | | | | if_track_previous_path: false | | | | | | first step filter: account._tag IS NOT EMPTY | -----+----------------+--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------- | 1 | IndexScan | 2 | { | outputVar: { | | | | | ver: 0, rows: 2, execTime: 0us, totalTime: 958us | "colNames": [ | | | | | "127.0.0.1":9779 exec/total: 288(us)/830(us) | "_vid" | | | | | storage_detail: {IndexLimitNode(limit=9223372036854775807):207(us),IndexProjectionNode(projectColumn=[_vid]):208(us),IndexVertexScanNode(IndexID=15, Path=()):210(us)} | ], | | | | | } | "type": "DATASET", | | | | | | "name": "IndexScan_1" | | | | | | } | | | | | | inputVar: | | | | | | space: 1 | | | | | | dedup: false | | | | | | limit: 9223372036854775807 | | | | | | filter: | | | | | | orderBy: [] | | | | | | schemaId: 13 | | | | | | isEdge: false | | | | | | returnCols: [ | | | | | | "_vid" | | | | | | ] | | | | | | indexCtx: [ | | | | | | { | | | | | | "columnHints": [], | | | | | | "filter": "", | | | | | | "index_id": 15 | | | | | | } | | | | | | ] | -----+----------------+--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------- | 2 | Start | | ver: 0, rows: 0, execTime: 0us, totalTime: 20us | outputVar: { | | | | | | "colNames": [], | | | | | | "type": "DATASET", | | | | | | "name": "__Start_2" | | | | | | } | -----+----------------+--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------
Mon, 07 Nov 2022 03:03:42 EST
# ngbatis
```cmd
- nGql:USE userProfile;
MATCH (n1: account)-[r: login*2]-(n2: account)
WHERE n1.account.accountUuid == $p0
RETURN n2.account.accountUuid as accountUuid
- params: {p0=account001}
- result:ColumnName: [accountUuid], Rows: []
@wey-gu @CorvusYe
Console 里执行,包括看计划,这里内核没有问题
(root@nebula) [userProfile]> :param p0 => 'account001';
(root@nebula) [userProfile]> profile MATCH (n1: account)-[r: login*2]-( n2: account) WHERE n1.account.accountUuid ==$p0
RETURN n2.account.accountUuid as accountUuid
+--------------+
| accountUuid |
+--------------+
| "account003" |
+--------------+
具体 ngbatis 里要怎么弄 @CorvusYe 帮忙看看他哪里写错了哈
(root@nebula) [userProfile]> profile MATCH (n1: account)-[r: login*2]-( n2: account) -> WHERE n1.account.accountUuid == '${p0}' -> RETURN n2.account.accountUuid as accountUuid
这个query 写的不对哈,应该是
WHERE n1.account.accountUuid == $p0
@wey-gu
${p0}
是 ngbatis 的占位符,会直接把 {p0=account001} 中的 account001 替换到${p0}
的位置,形成 ‘account001’
嗯嗯,我说的是 console 里 param 的写法,之前的是不对的。
nebula-console
(root@nebula) [userProfile]> MATCH (n1: account)-[r: login*2]-( n2: account) WHERE n1.account.accountUuid == 'account001' RETURN n2.account.accountUuid as accountUuid +--------------+ | accountUuid | +--------------+ | "account003" | +--------------+ Got 1 rows (time spent 3191/3710 us)
ngbatis
- nGql:USE userProfile; MATCH (n1: account)-[r: login*2]-(n2: account) WHERE n1.account.accountUuid == 'account001' RETURN n2.account.accountUuid as accountUuid - params: {p0=account001} - result:ColumnName: [accountUuid], Rows: []
@wey-gu @CorvusYe 大佬们帮忙看看这个也是索引下推的问题?
这里我也没看出问题,ngbatis 打印的日志是已经将参数替换到nGQL的结果,这条脚本会被直接执行到nebula中
MATCH (n1: account)-[r: login*2]-(n2: account)
WHERE n1.account.accountUuid == 'account001'
RETURN n2.account.accountUuid as accountUuid
输出的 result 也是还没处理过的 ResultSet,可能需要断点 debug 一下看看
nebula-console
(root@nebula) [userProfile]> MATCH (n1: account)-[r: login*2]-( n2: account) WHERE n1.account.accountUuid == 'account001' RETURN n2.account.accountUuid as accountUuid +--------------+ | accountUuid | +--------------+ | "account003" | +--------------+ Got 1 rows (time spent 3191/3710 us)
ngbatis
- nGql:USE userProfile; MATCH (n1: account)-[r: login*2]-(n2: account) WHERE n1.account.accountUuid == 'account001' RETURN n2.account.accountUuid as accountUuid - params: {p0=account001} - result:ColumnName: [accountUuid], Rows: []
@wey-gu @CorvusYe 大佬们帮忙看看这个也是索引下推的问题?
这里我也没看出问题,ngbatis 打印的日志是已经将参数替换到nGQL的结果,这条脚本会被直接执行到nebula中
MATCH (n1: account)-[r: login*2]-(n2: account) WHERE n1.account.accountUuid == 'account001' RETURN n2.account.accountUuid as accountUuid
输出的 result 也是还没处理过的 ResultSet,可能需要断点 debug 一下看看
ExecutionResponse (
error_code : SUCCEEDED (SUCCEEDED),
latency_in_us : 4214,
data : DataSet (
column_names : [
[B@47a90d2a
],
rows : [
]
),
space_name : 75 73 65 72 50 72 6F 66 69 6C 65
)
这里其实就相当于拿一条不需要参数拼接的完整的nGQL进行查询,返回空数据,相当于写session.executeWithParameter,方便用这个例子写个main函数进行调试不
相当于拿一条不需要参数拼接的完整的nGQL进行查询,返回空数据,相当于写session.executeWithParameter,方便用这个例子写个main函数进行调试不
直接在代码里拿同个session debug结果如下:
session.executeWithParameter("USE userProfile; MATCH (n1: account)-[r: login*2]-(n2: account) WHERE n1.account.accountUuid == $p0 RETURN n2.account.accountUuid as accountUuid",params);
ExecutionResponse (
error_code : SUCCEEDED (SUCCEEDED),
latency_in_us : 3846,
data : DataSet (
column_names : [
[B@1bd53c5c
],
rows : [
Row (
values : [
<Value sVal:61 63 63 6f 75 6e 74 30 30 33>
]
)
]
),
space_name : 75 73 65 72 50 72 6F 66 69 6C 65
)
session debug结果如下:
现在的现象是我debug进行一次session.executeWithParameter()后,放行该测试方法就可以返回正确的结果。debug与正常执行的差异是 debug后执行的语句没有选择图空间use userProfile;
会不会是正常执行的结果其实是use userProfie
的结果呢?@wey-gu @CorvusYe
session debug结果如下:
现在的现象是我debug进行一次session.executeWithParameter()后,放行该测试方法就可以返回正确的结果。debug与正常执行的差异是 debug后执行的语句没有选择图空间
use userProfile;
会不会是正常执行的结果其实是use userProfie
的结果呢?@wey-gu @CorvusYe
重新debug了一次,第二次执行、第n次
session.executeWithParameter("USE userProfile; MATCH (n1: account)-[r: login*2]-(n2: account) WHERE n1.account.accountUuid == $p0 RETURN n2.account.accountUuid as accountUuid",params);
每次都是有正常返回的。
ngbatis打印日志:
nebula执行
都是在rebuild index之后执行。