nebula 3.1.0 建索引后查询很慢

版本

3.1.0

部署

3台节点(32c,128G),固态硬盘

问题类型

创建索引后查询速度很慢

nsql

CREATE EDGE INDEX g_g_links_source_index on g_g_links(f_data_source(30));
REBUILD EDGE INDEX g_g_links_source_index;

MATCH ()-[e:g_g_links{f_data_source:"GTRD"}]->() RETURN e limit 3(很慢)

数据量

顶点8万,边4千万

Got 3 rows (time spent 213618704/215292168 us)

Execution Plan (optimize time 114 us)

-----+----------------+--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------
| id | name           | dependencies | profiling data                                                                                                                                                                                         | operator info                                  |
-----+----------------+--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------
| 14 | Project        | 12           | ver: 0, rows: 3, execTime: 7495us, totalTime: 7497us                                                                                                                                                   | outputVar: {                                   |
|    |                |              |                                                                                                                                                                                                        |   "colNames": [                                |
|    |                |              |                                                                                                                                                                                                        |     "e"                                        |
|    |                |              |                                                                                                                                                                                                        |   ],                                           |
|    |                |              |                                                                                                                                                                                                        |   "type": "DATASET",                           |
|    |                |              |                                                                                                                                                                                                        |   "name": "__DataCollect_9"                    |
|    |                |              |                                                                                                                                                                                                        | }                                              |
|    |                |              |                                                                                                                                                                                                        | inputVar: __Limit_12                           |
|    |                |              |                                                                                                                                                                                                        | columns: [                                     |
|    |                |              |                                                                                                                                                                                                        |   "$-.e[0] AS e"                               |
|    |                |              |                                                                                                                                                                                                        | ]                                              |
-----+----------------+--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------
| 12 | Limit          | 5            | ver: 0, rows: 3, execTime: 14461118us, totalTime: 14461121us                                                                                                                                           | outputVar: {                                   |
|    |                |              |                                                                                                                                                                                                        |   "colNames": [                                |
|    |                |              |                                                                                                                                                                                                        |     "__VAR_0",                                 |
|    |                |              |                                                                                                                                                                                                        |     "e",                                       |
|    |                |              |                                                                                                                                                                                                        |     "__VAR_1"                                  |
|    |                |              |                                                                                                                                                                                                        |   ],                                           |
|    |                |              |                                                                                                                                                                                                        |   "type": "DATASET",                           |
|    |                |              |                                                                                                                                                                                                        |   "name": "__Limit_12"                         |
|    |                |              |                                                                                                                                                                                                        | }                                              |
|    |                |              |                                                                                                                                                                                                        | inputVar: __AppendVertices_5                   |
|    |                |              |                                                                                                                                                                                                        | offset: 0                                      |
|    |                |              |                                                                                                                                                                                                        | count: 3                                       |
-----+----------------+--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------
|  5 | AppendVertices | 4            | {                                                                                                                                                                                                      | outputVar: {                                   |
|    |                |              | ver: 0, rows: 9440908, execTime: 80086085us, totalTime: 80498761us                                                                                                                                     |   "colNames": [                                |
|    |                |              | "x.x.x.139":9779 exec/total: 428849(us)/452994(us)                                                                                                                                                 |     "__VAR_0",                                 |
|    |                |              | total_rpc: 463577(us)                                                                                                                                                                                  |     "e",                                       |
|    |                |              | "x.x.x.137":9779 exec/total: 240416(us)/273496(us)                                                                                                                                                 |     "__VAR_1"                                  |
|    |                |              | "x.x.x.138":9779 exec/total: 151398(us)/162645(us)                                                                                                                                                 |   ],                                           |
|    |                |              | }                                                                                                                                                                                                      |   "type": "DATASET",                           |
|    |                |              |                                                                                                                                                                                                        |   "name": "__AppendVertices_5"                 |
|    |                |              |                                                                                                                                                                                                        | }                                              |
|    |                |              |                                                                                                                                                                                                        | inputVar: __Traverse_4                         |
|    |                |              |                                                                                                                                                                                                        | space: 11                                      |
|    |                |              |                                                                                                                                                                                                        | dedup: true                                    |
|    |                |              |                                                                                                                                                                                                        | limit: -1                                      |
|    |                |              |                                                                                                                                                                                                        | filter:                                        |
|    |                |              |                                                                                                                                                                                                        | orderBy: []                                    |
|    |                |              |                                                                                                                                                                                                        | src: none_direct_dst($-.e)                     |
|    |                |              |                                                                                                                                                                                                        | props: [                                       |
|    |                |              |                                                                                                                                                                                                        |   {                                            |
|    |                |              |                                                                                                                                                                                                        |     "props": [                                 |
|    |                |              |                                                                                                                                                                                                        |       "p_id",                                  |
|    |                |              |                                                                                                                                                                                                        |       "_tag"                                   |
|    |                |              |                                                                                                                                                                                                        |     ],                                         |
|    |                |              |                                                                                                                                                                                                        |     "tagId": 12                                |
|    |                |              |                                                                                                                                                                                                        |   },                                           |
|    |                |              |                                                                                                                                                                                                        |   {                                            |
|    |                |              |                                                                                                                                                                                                        |     "props": [                                 |
|    |                |              |                                                                                                                                                                                                        |       "g_id",                                  |
|    |                |              |                                                                                                                                                                                                        |       "_tag"                                   |
|    |                |              |                                                                                                                                                                                                        |     ],                                         |
|    |                |              |                                                                                                                                                                                                        |     "tagId": 13                                |
|    |                |              |                                                                                                                                                                                                        |   }                                            |
|    |                |              |                                                                                                                                                                                                        | ]                                              |
|    |                |              |                                                                                                                                                                                                        | exprs:                                         |
|    |                |              |                                                                                                                                                                                                        | vertex_filter:                                 |
|    |                |              |                                                                                                                                                                                                        | if_track_previous_path: true                   |
-----+----------------+--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------
|  4 | Traverse       | 2            | {                                                                                                                                                                                                      | outputVar: {                                   |
|    |                |              | ver: 0, rows: 9440908, execTime: 81043253us, totalTime: 114374231us                                                                                                                                    |   "colNames": [                                |
|    |                |              | step 1: {                                                                                                                                                                                              |     "__VAR_0",                                 |
|    |                |              | {"x.x.x.139":9779 exec/total/vertices: 19225341(us)/33322342(us)/456,                                                                                                                              |     "e"                                        |
|    |                |              | total_rpc_time: 33322689(us)                                                                                                                                                                           |   ],                                           |
|    |                |              | storage_detail: {GetNeighborsNode:19224852(us),HashJoinNode:17035(us),RelNode:19224912(us),SingleEdgeNode:9421(us),TagNode:6706(us)}                                                                   |   "type": "DATASET",                           |
|    |                |              | }{"x.x.x.138":9779 exec/total/vertices: 11358007(us)/19340788(us)/231,                                                                                                                             |   "name": "__Traverse_4"                       |
|    |                |              | total_rpc_time: 33322689(us)                                                                                                                                                                           | }                                              |
|    |                |              | storage_detail: {GetNeighborsNode:11357657(us),HashJoinNode:9490(us),RelNode:11357699(us),SingleEdgeNode:5007(us),TagNode:3956(us)}                                                                    | inputVar: __Dedup_2                            |
|    |                |              | }{"x.x.x.137":9779 exec/total/vertices: 16237584(us)/28277648(us)/441,                                                                                                                             | space: 11                                      |
|    |                |              | total_rpc_time: 33322689(us)                                                                                                                                                                           | dedup: true                                    |
|    |                |              | storage_detail: {GetNeighborsNode:16237113(us),HashJoinNode:16353(us),RelNode:16237169(us),SingleEdgeNode:9295(us),TagNode:6217(us)}                                                                   | limit: -1                                      |
|    |                |              | }                                                                                                                                                                                                      | filter:                                        |
|    |                |              | }                                                                                                                                                                                                      | orderBy: []                                    |
|    |                |              | }                                                                                                                                                                                                      | src: $_vid                                     |
|    |                |              |                                                                                                                                                                                                        | edgeTypes: []                                  |
|    |                |              |                                                                                                                                                                                                        | edgeDirection: OUT_EDGE                        |
|    |                |              |                                                                                                                                                                                                        | vertexProps: [                                 |
|    |                |              |                                                                                                                                                                                                        |   {                                            |
|    |                |              |                                                                                                                                                                                                        |     "props": [                                 |
|    |                |              |                                                                                                                                                                                                        |       "p_id",                                  |
|    |                |              |                                                                                                                                                                                                        |       "_tag"                                   |
|    |                |              |                                                                                                                                                                                                        |     ],                                         |
|    |                |              |                                                                                                                                                                                                        |     "tagId": 12                                |
|    |                |              |                                                                                                                                                                                                        |   },                                           |
|    |                |              |                                                                                                                                                                                                        |   {                                            |
|    |                |              |                                                                                                                                                                                                        |     "props": [                                 |
|    |                |              |                                                                                                                                                                                                        |       "g_id",                                  |
|    |                |              |                                                                                                                                                                                                        |       "_tag"                                   |
|    |                |              |                                                                                                                                                                                                        |     ],                                         |
|    |                |              |                                                                                                                                                                                                        |     "tagId": 13                                |
|    |                |              |                                                                                                                                                                                                        |   }                                            |
|    |                |              |                                                                                                                                                                                                        | ]                                              |
|    |                |              |                                                                                                                                                                                                        | edgeProps: [                                   |
|    |                |              |                                                                                                                                                                                                        |   {                                            |
|    |                |              |                                                                                                                                                                                                        |     "props": [                                 |
|    |                |              |                                                                                                                                                                                                        |       "_src",                                  |
|    |                |              |                                                                                                                                                                                                        |       "_type",                                 |
|    |                |              |                                                                                                                                                                                                        |       "_rank",                                 |
|    |                |              |                                                                                                                                                                                                        |       "_dst",                                  |
|    |                |              |                                                                                                                                                                                                        |       "f_source_species",                          |
|    |                |              |                                                                                                                                                                                                        |       "f_data_source",                                  |
|    |                |              |                                                                                                                                                                                                        |     ],                                         |
|    |                |              |                                                                                                                                                                                                        |     "type": "14"                               |
|    |                |              |                                                                                                                                                                                                        |   }                                            |
|    |                |              |                                                                                                                                                                                                        | ]                                              |
|    |                |              |                                                                                                                                                                                                        | statProps:                                     |
|    |                |              |                                                                                                                                                                                                        | exprs:                                         |
|    |                |              |                                                                                                                                                                                                        | random: false                                  |
|    |                |              |                                                                                                                                                                                                        | steps:                                         |
|    |                |              |                                                                                                                                                                                                        | vertex filter:                                 |
|    |                |              |                                                                                                                                                                                                        | edge filter: (*.f_data_source=="GTRD")         |
|    |                |              |                                                                                                                                                                                                        | if_track_previous_path: false                  |
-----+----------------+--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------
|  2 | Dedup          | 10           | ver: 0, rows: 1128, execTime: 781242us, totalTime: 781246us                                                                                                                                            | outputVar: {                                   |
|    |                |              |                                                                                                                                                                                                        |   "colNames": [                                |
|    |                |              |                                                                                                                                                                                                        |     "_vid"                                     |
|    |                |              |                                                                                                                                                                                                        |   ],                                           |
|    |                |              |                                                                                                                                                                                                        |   "type": "DATASET",                           |
|    |                |              |                                                                                                                                                                                                        |   "name": "__Dedup_2"                          |
|    |                |              |                                                                                                                                                                                                        | }                                              |
|    |                |              |                                                                                                                                                                                                        | inputVar: __IndexScan_1                        |
-----+----------------+--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------
| 10 | IndexScan      | 3            | {                                                                                                                                                                                                      | outputVar: {                                   |
|    |                |              | ver: 0, rows: 9440908, execTime: 0us, totalTime: 3483185us                                                                                                                                             |   "colNames": [                                |
|    |                |              | "x.x.x.139":9779 exec/total: 2538273(us)/3003972(us)                                                                                                                                               |     "_vid"                                     |
|    |                |              | "x.x.x.138":9779 exec/total: 1672100(us)/1993147(us)                                                                                                                                               |   ],                                           |
|    |                |              | "x.x.x.137":9779 exec/total: 2088428(us)/2478427(us)                                                                                                                                               |   "type": "DATASET",                           |
|    |                |              | storage_detail: {IndexEdgeScanNode(IndexID=18, Path=(f_data_source="GTRD", )):1283452(us),IndexLimitNode(limit=9223372036854775807):1906061(us),IndexProjectionNode(projectColumn=[_src]):1791979(us)} |   "name": "__IndexScan_1"                      |
|    |                |              | }                                                                                                                                                                                                      | }                                              |
|    |                |              |                                                                                                                                                                                                        | inputVar:                                      |
|    |                |              |                                                                                                                                                                                                        | space: 11                                      |
|    |                |              |                                                                                                                                                                                                        | dedup: false                                   |
|    |                |              |                                                                                                                                                                                                        | limit: 9223372036854775807                     |
|    |                |              |                                                                                                                                                                                                        | filter:                                        |
|    |                |              |                                                                                                                                                                                                        | orderBy: []                                    |
|    |                |              |                                                                                                                                                                                                        | schemaId: 14                                   |
|    |                |              |                                                                                                                                                                                                        | isEdge: true                                   |
|    |                |              |                                                                                                                                                                                                        | returnCols: [                                  |
|    |                |              |                                                                                                                                                                                                        |   "_src"                                       |
|    |                |              |                                                                                                                                                                                                        | ]                                              |
|    |                |              |                                                                                                                                                                                                        | indexCtx: [                                    |
|    |                |              |                                                                                                                                                                                                        |   {                                            |
|    |                |              |                                                                                                                                                                                                        |     "columnHints": [                           |
|    |                |              |                                                                                                                                                                                                        |       {                                        |
|    |                |              |                                                                                                                                                                                                        |         "includeEnd": "false",                 |
|    |                |              |                                                                                                                                                                                                        |         "includeBegin": "true",                |
|    |                |              |                                                                                                                                                                                                        |         "endValue": "__EMPTY__",               |
|    |                |              |                                                                                                                                                                                                        |         "beginValue": "\"GTRD\"",              |
|    |                |              |                                                                                                                                                                                                        |         "scanType": "PREFIX",                  |
|    |                |              |                                                                                                                                                                                                        |         "column": "f_data_source"              |
|    |                |              |                                                                                                                                                                                                        |       }                                        |
|    |                |              |                                                                                                                                                                                                        |     ],                                         |
|    |                |              |                                                                                                                                                                                                        |     "filter": "",                              |
|    |                |              |                                                                                                                                                                                                        |     "index_id": 18                             |
|    |                |              |                                                                                                                                                                                                        |   }                                            |
|    |                |              |                                                                                                                                                                                                        | ]                                              |
-----+----------------+--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------
|  3 | Start          |              | ver: 0, rows: 0, execTime: 0us, totalTime: 20us                                                                                                                                                        | outputVar: {                                   |
|    |                |              |                                                                                                                                                                                                        |   "colNames": [],                              |
|    |                |              |                                                                                                                                                                                                        |   "type": "DATASET",                           |
|    |                |              |                                                                                                                                                                                                        |   "name": "__Start_3"                          |
|    |                |              |                                                                                                                                                                                                        | }                                              |
-----+----------------+--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------

Tue, 07 Jun 2022 20:51:16 CST

不加LIMIT快吗

重复执行下,如果还是这么慢的话,我提个issue.

不加limit时间很长,没有等到结果,让他退出了

重复执行依然很慢

那我提个issue https://github.com/vesoft-inc/nebula/issues/4308

之前官方说match的limit还没下推,换其他语句试试? :thinking:

改用了lookup 语句,可以在1s内返回结果,但是lookup使用的时候有个问题,where条件不可以用 in 查询 ,会使得graphd 节点exit ,并产生core文件,这里是不是有个bug

能贴下脱敏后详细的查询语句和graphd错误日志吗?

语句
lookup on g_g_links2 where g_g_links2.f_cell_type_L2 in [‘B’] yield src(edge) as start|limit 10
日志
产生了二进制core文件,ERROR日志没有输出直接exit的

好的,感谢。你用的是debug版本吗?

不是,问题已经找到了
match limit没有进行下推,会扫描所有数据然后返回

1 个赞

可以勾选你自己的回复为解决方案哈