nebula 索引查询问题

你到底对哪个字段创建了索引,一会日期,一会故障日期,一会隐患日期的,这 3 个是不同的字段名啊。

1 个赞

隐患和故障的索引字段都是日期 第一个日期 是单独查询某个tag日明细出来的结果
后面挂接查询的时候 日期就没有值了 指定日期为过滤条件也查不出来 但是单独返回tag的日期 却是有值的

嗯,我大概明白背景了,你这些索引是全文索引还是原生索引。fulltext 就是全文索引。

profile.csv (45.4 KB)
这是执行计划

自己代码创建tag的时候 一同创建的 应该是 全文索引

上面说了,全文索引的关键词是 fulltext,你的代码都没提到。我给你把问题标签改了。

你的这个 csv 文件是没有数据返回的执行计划,对吧?

你的执行计划和思为之前的 nGQL 简明教程 vol.02 执行计划详解与调优 这个例子有点像,应该是没有 limit 没有下推,数据量多的话,可能查询过慢没有结果返回。

我这个执行计划的查询语句是下面的


主要是 单个查询故障11日明细 他里面的属性 日期是有数据的 但是这样查询 日期没有数据


FETCH PROP
LOOKUP
分别查一下这个点,看看什么结果呢?

我这边没法复现

(root@nebula) [basketballplayer]> profile match (m:player)--(n:team) return m,n limit 1
+-----------------------------------------------------------+---------------------------------+
| m                                                         | n                               |
+-----------------------------------------------------------+---------------------------------+
| ("player147" :player{age: 36, name: "Amar'e Stoudemire"}) | ("team214" :team{name: "Suns"}) |
+-----------------------------------------------------------+---------------------------------+
Got 1 rows (time spent 19.59ms/135.355125ms)

Execution Plan (optimize time 550 us)

-----+----------------+--------------+----------------------------------------------------------------+----------------------------------------------
| id | name           | dependencies | profiling data                                                 | operator info                               |
-----+----------------+--------------+----------------------------------------------------------------+----------------------------------------------
| 12 | Project        | 11           | {                                                              | outputVar: {                                |
|    |                |              |   "execTime": "17(us)",                                        |   "colNames": [                             |
|    |                |              |   "rows": 1,                                                   |     "m",                                    |
|    |                |              |   "totalTime": "20(us)",                                       |     "n"                                     |
|    |                |              |   "version": 0                                                 |   ],                                        |
|    |                |              | }                                                              |   "type": "DATASET",                        |
|    |                |              |                                                                |   "name": "__Limit_7"                       |
|    |                |              |                                                                | }                                           |
|    |                |              |                                                                | inputVar: __Limit_11                        |
|    |                |              |                                                                | columns: [                                  |
|    |                |              |                                                                |   "$-.m AS m",                              |
|    |                |              |                                                                |   "$-.n AS n"                               |
|    |                |              |                                                                | ]                                           |
-----+----------------+--------------+----------------------------------------------------------------+----------------------------------------------
| 11 | Limit          | 10           | {                                                              | outputVar: {                                |
|    |                |              |   "execTime": "126(us)",                                       |   "colNames": [                             |
|    |                |              |   "rows": 1,                                                   |     "m",                                    |
|    |                |              |   "totalTime": "144(us)",                                      |     "__VAR_0",                              |
|    |                |              |   "version": 0                                                 |     "n"                                     |
|    |                |              | }                                                              |   ],                                        |
|    |                |              |                                                                |   "type": "DATASET",                        |
|    |                |              |                                                                |   "name": "__Limit_11"                      |
|    |                |              |                                                                | }                                           |
|    |                |              |                                                                | inputVar: __AppendVertices_4                |
|    |                |              |                                                                | offset: 0                                   |
|    |                |              |                                                                | count: 1                                    |
-----+----------------+--------------+----------------------------------------------------------------+----------------------------------------------
| 10 | AppendVertices | 9            | {                                                              | outputVar: {                                |
|    |                |              |   "execTime": "1725(us)",                                      |   "colNames": [                             |
|    |                |              |   "resp[0]": {                                                 |     "m",                                    |
|    |                |              |     "exec": "1283(us)",                                        |     "__VAR_0",                              |
|    |                |              |     "host": "storaged1:9779",                                  |     "n"                                     |
|    |                |              |     "total": "2921(us)"                                        |   ],                                        |
|    |                |              |   },                                                           |   "type": "DATASET",                        |
|    |                |              |   "resp[1]": {                                                 |   "name": "__AppendVertices_4"              |
|    |                |              |     "exec": "1341(us)",                                        | }                                           |
|    |                |              |     "host": "storaged2:9779",                                  | inputVar: __Traverse_3                      |
|    |                |              |     "total": "3235(us)"                                        | space: 1                                    |
|    |                |              |   },                                                           | dedup: 1                                    |
|    |                |              |   "resp[2]": {                                                 | limit: -1                                   |
|    |                |              |     "exec": "1235(us)",                                        | filter: team._tag IS NOT EMPTY              |
|    |                |              |     "host": "storaged0:9779",                                  | orderBy: []                                 |
|    |                |              |     "total": "2937(us)"                                        | src: none_direct_dst($-.__VAR_0,$-.m)       |
|    |                |              |   },                                                           | props: [                                    |
|    |                |              |   "rows": 152,                                                 |   {                                         |
|    |                |              |   "totalTime": "4830(us)",                                     |     "props": [                              |
|    |                |              |   "total_rpc": "3661(us)",                                     |       "name",                               |
|    |                |              |   "version": 0                                                 |       "geo_point",                          |
|    |                |              | }                                                              |       "_tag"                                |
|    |                |              |                                                                |     ],                                      |
|    |                |              |                                                                |     "tagId": 12                             |
|    |                |              |                                                                |   },                                        |
|    |                |              |                                                                |   {                                         |
|    |                |              |                                                                |     "props": [                              |
|    |                |              |                                                                |       "name",                               |
|    |                |              |                                                                |       "age",                                |
|    |                |              |                                                                |       "_tag"                                |
|    |                |              |                                                                |     ],                                      |
|    |                |              |                                                                |     "tagId": 2                              |
|    |                |              |                                                                |   },                                        |
|    |                |              |                                                                |   {                                         |
|    |                |              |                                                                |     "props": [                              |
|    |                |              |                                                                |       "address",                            |
|    |                |              |                                                                |       "geo_point",                          |
|    |                |              |                                                                |       "_tag"                                |
|    |                |              |                                                                |     ],                                      |
|    |                |              |                                                                |     "tagId": 11                             |
|    |                |              |                                                                |   },                                        |
|    |                |              |                                                                |   {                                         |
|    |                |              |                                                                |     "props": [                              |
|    |                |              |                                                                |       "title",                              |
|    |                |              |                                                                |       "_tag"                                |
|    |                |              |                                                                |     ],                                      |
|    |                |              |                                                                |     "tagId": 8                              |
|    |                |              |                                                                |   },                                        |
|    |                |              |                                                                |   {                                         |
|    |                |              |                                                                |     "props": [                              |
|    |                |              |                                                                |       "name",                               |
|    |                |              |                                                                |       "_tag"                                |
|    |                |              |                                                                |     ],                                      |
|    |                |              |                                                                |     "tagId": 3                              |
|    |                |              |                                                                |   }                                         |
|    |                |              |                                                                | ]                                           |
|    |                |              |                                                                | exprs:                                      |
|    |                |              |                                                                | vertex_filter:                              |
|    |                |              |                                                                | if_track_previous_path: true                |
-----+----------------+--------------+----------------------------------------------------------------+----------------------------------------------
|  9 | Traverse       | 1            | {                                                              | outputVar: {                                |
|    |                |              |   "execTime": "211(us)",                                       |   "colNames": [                             |
|    |                |              |   "expandPostTaskTime": "122(us)",                             |     "m",                                    |
|    |                |              |   "expandTaskRunTime": [                                       |     "__VAR_0"                               |
|    |                |              |     305,                                                       |   ],                                        |
|    |                |              |     352,                                                       |   "type": "DATASET",                        |
|    |                |              |     521                                                        |   "name": "__Traverse_3"                    |
|    |                |              |   ],                                                           | }                                           |
|    |                |              |   "expandTime": "929(us)",                                     | inputVar: __IndexScan_1                     |
|    |                |              |   "rows": 389,                                                 | space: 1                                    |
|    |                |              |   "step[1]": {                                                 | dedup: 1                                    |
|    |                |              |     "storage": [                                               | limit: -1                                   |
|    |                |              |       {                                                        | filter:                                     |
|    |                |              |         "exec": "4131(us)",                                    | orderBy: []                                 |
|    |                |              |         "host": "storaged1:9779",                              | src: $_vid                                  |
|    |                |              |         "storage_detail": {                                    | edgeTypes: []                               |
|    |                |              |           "FilterNode": "6497(us)",                            | edgeDirection: BOTH                         |
|    |                |              |           "GetNeighborsNode": "7237(us)",                      | vertexProps: [                              |
|    |                |              |           "HashJoinNode": "6439(us)",                          |   {                                         |
|    |                |              |           "RelNode": "7240(us)",                               |     "props": [                              |
|    |                |              |           "SingleEdgeNode": "4611(us)",                        |       "name",                               |
|    |                |              |           "TagNode": "1591(us)"                                |       "geo_point",                          |
|    |                |              |         },                                                     |       "_tag"                                |
|    |                |              |         "total": "6751(us)",                                   |     ],                                      |
|    |                |              |         "vertices": 13                                         |     "tagId": 12                             |
|    |                |              |       },                                                       |   },                                        |
|    |                |              |       {                                                        |   {                                         |
|    |                |              |         "exec": "3401(us)",                                    |     "props": [                              |
|    |                |              |         "host": "storaged0:9779",                              |       "name",                               |
|    |                |              |         "storage_detail": {                                    |       "age",                                |
|    |                |              |           "FilterNode": "5348(us)",                            |       "_tag"                                |
|    |                |              |           "GetNeighborsNode": "6008(us)",                      |     ],                                      |
|    |                |              |           "HashJoinNode": "5300(us)",                          |     "tagId": 2                              |
|    |                |              |           "RelNode": "6010(us)",                               |   },                                        |
|    |                |              |           "SingleEdgeNode": "3939(us)",                        |   {                                         |
|    |                |              |           "TagNode": "1169(us)"                                |     "props": [                              |
|    |                |              |         },                                                     |       "address",                            |
|    |                |              |         "total": "6031(us)",                                   |       "geo_point",                          |
|    |                |              |         "vertices": 13                                         |       "_tag"                                |
|    |                |              |       },                                                       |     ],                                      |
|    |                |              |       {                                                        |     "tagId": 11                             |
|    |                |              |         "exec": "3296(us)",                                    |   },                                        |
|    |                |              |         "host": "storaged2:9779",                              |   {                                         |
|    |                |              |         "storage_detail": {                                    |     "props": [                              |
|    |                |              |           "FilterNode": "7643(us)",                            |       "title",                              |
|    |                |              |           "GetNeighborsNode": "8637(us)",                      |       "_tag"                                |
|    |                |              |           "HashJoinNode": "7576(us)",                          |     ],                                      |
|    |                |              |           "RelNode": "8642(us)",                               |     "tagId": 8                              |
|    |                |              |           "SingleEdgeNode": "5548(us)",                        |   },                                        |
|    |                |              |           "TagNode": "1750(us)"                                |   {                                         |
|    |                |              |         },                                                     |     "props": [                              |
|    |                |              |         "total": "5785(us)",                                   |       "name",                               |
|    |                |              |         "vertices": 25                                         |       "_tag"                                |
|    |                |              |       }                                                        |     ],                                      |
|    |                |              |     ],                                                         |     "tagId": 3                              |
|    |                |              |     "total_rpc_time": "6984(us)"                               |   }                                         |
|    |                |              |   },                                                           | ]                                           |
|    |                |              |   "totalTime": "8478(us)",                                     | edgeProps: [                                |
|    |                |              |   "version": 0                                                 |   {                                         |
|    |                |              | }                                                              |     "props": [                              |
|    |                |              |                                                                |       "_dst",                               |
|    |                |              |                                                                |       "_type",                              |
|    |                |              |                                                                |       "_rank"                               |
|    |                |              |                                                                |     ],                                      |
|    |                |              |                                                                |     "type": -4                              |
|    |                |              |                                                                |   },                                        |
|    |                |              |                                                                |   {                                         |
|    |                |              |                                                                |     "props": [                              |
|    |                |              |                                                                |       "_dst",                               |
|    |                |              |                                                                |       "_type",                              |
|    |                |              |                                                                |       "_rank"                               |
|    |                |              |                                                                |     ],                                      |
|    |                |              |                                                                |     "type": 4                               |
|    |                |              |                                                                |   },                                        |
|    |                |              |                                                                |   {                                         |
|    |                |              |                                                                |     "props": [                              |
|    |                |              |                                                                |       "_dst",                               |
|    |                |              |                                                                |       "_type",                              |
|    |                |              |                                                                |       "_rank"                               |
|    |                |              |                                                                |     ],                                      |
|    |                |              |                                                                |     "type": -10                             |
|    |                |              |                                                                |   },                                        |
|    |                |              |                                                                |   {                                         |
|    |                |              |                                                                |     "props": [                              |
|    |                |              |                                                                |       "_dst",                               |
|    |                |              |                                                                |       "_type",                              |
|    |                |              |                                                                |       "_rank"                               |
|    |                |              |                                                                |     ],                                      |
|    |                |              |                                                                |     "type": 10                              |
|    |                |              |                                                                |   },                                        |
|    |                |              |                                                                |   {                                         |
|    |                |              |                                                                |     "props": [                              |
|    |                |              |                                                                |       "_dst",                               |
|    |                |              |                                                                |       "_type",                              |
|    |                |              |                                                                |       "_rank"                               |
|    |                |              |                                                                |     ],                                      |
|    |                |              |                                                                |     "type": -5                              |
|    |                |              |                                                                |   },                                        |
|    |                |              |                                                                |   {                                         |
|    |                |              |                                                                |     "props": [                              |
|    |                |              |                                                                |       "_dst",                               |
|    |                |              |                                                                |       "_type",                              |
|    |                |              |                                                                |       "_rank"                               |
|    |                |              |                                                                |     ],                                      |
|    |                |              |                                                                |     "type": 5                               |
|    |                |              |                                                                |   },                                        |
|    |                |              |                                                                |   {                                         |
|    |                |              |                                                                |     "props": [                              |
|    |                |              |                                                                |       "_dst",                               |
|    |                |              |                                                                |       "_type",                              |
|    |                |              |                                                                |       "_rank"                               |
|    |                |              |                                                                |     ],                                      |
|    |                |              |                                                                |     "type": -13                             |
|    |                |              |                                                                |   },                                        |
|    |                |              |                                                                |   {                                         |
|    |                |              |                                                                |     "props": [                              |
|    |                |              |                                                                |       "_dst",                               |
|    |                |              |                                                                |       "_type",                              |
|    |                |              |                                                                |       "_rank"                               |
|    |                |              |                                                                |     ],                                      |
|    |                |              |                                                                |     "type": 13                              |
|    |                |              |                                                                |   },                                        |
|    |                |              |                                                                |   {                                         |
|    |                |              |                                                                |     "props": [                              |
|    |                |              |                                                                |       "_dst",                               |
|    |                |              |                                                                |       "_type",                              |
|    |                |              |                                                                |       "_rank"                               |
|    |                |              |                                                                |     ],                                      |
|    |                |              |                                                                |     "type": -9                              |
|    |                |              |                                                                |   },                                        |
|    |                |              |                                                                |   {                                         |
|    |                |              |                                                                |     "props": [                              |
|    |                |              |                                                                |       "_dst",                               |
|    |                |              |                                                                |       "_type",                              |
|    |                |              |                                                                |       "_rank"                               |
|    |                |              |                                                                |     ],                                      |
|    |                |              |                                                                |     "type": 9                               |
|    |                |              |                                                                |   },                                        |
|    |                |              |                                                                |   {                                         |
|    |                |              |                                                                |     "props": [                              |
|    |                |              |                                                                |       "_dst",                               |
|    |                |              |                                                                |       "_type",                              |
|    |                |              |                                                                |       "_rank"                               |
|    |                |              |                                                                |     ],                                      |
|    |                |              |                                                                |     "type": -14                             |
|    |                |              |                                                                |   },                                        |
|    |                |              |                                                                |   {                                         |
|    |                |              |                                                                |     "props": [                              |
|    |                |              |                                                                |       "_dst",                               |
|    |                |              |                                                                |       "_type",                              |
|    |                |              |                                                                |       "_rank"                               |
|    |                |              |                                                                |     ],                                      |
|    |                |              |                                                                |     "type": 14                              |
|    |                |              |                                                                |   }                                         |
|    |                |              |                                                                | ]                                           |
|    |                |              |                                                                | statProps:                                  |
|    |                |              |                                                                | exprs:                                      |
|    |                |              |                                                                | random: false                               |
|    |                |              |                                                                | steps: 1..1                                 |
|    |                |              |                                                                | vertex filter:                              |
|    |                |              |                                                                | edge filter:                                |
|    |                |              |                                                                | if_track_previous_path: false               |
|    |                |              |                                                                | first step filter: player._tag IS NOT EMPTY |
|    |                |              |                                                                | tag filter: player._tag IS NOT EMPTY        |
-----+----------------+--------------+----------------------------------------------------------------+----------------------------------------------
|  1 | IndexScan      | 2            | {                                                              | outputVar: {                                |
|    |                |              |   "execTime": "0(us)",                                         |   "colNames": [                             |
|    |                |              |   "resp[0]": {                                                 |     "_vid"                                  |
|    |                |              |     "exec": "678(us)",                                         |   ],                                        |
|    |                |              |     "host": "storaged0:9779",                                  |   "type": "DATASET",                        |
|    |                |              |     "storage_detail": {                                        |   "name": "__IndexScan_1"                   |
|    |                |              |       "IndexLimitNode(limit=9223372036854775807)": "1082(us)", | }                                           |
|    |                |              |       "IndexProjectionNode(projectColumn=[_vid])": "1084(us)", | inputVar:                                   |
|    |                |              |       "IndexVertexScanNode(IndexID=6, Path=())": "1073(us)"    | space: 1                                    |
|    |                |              |     },                                                         | dedup: 0                                    |
|    |                |              |     "total": "4102(us)"                                        | limit: 9223372036854775807                  |
|    |                |              |   },                                                           | filter:                                     |
|    |                |              |   "resp[1]": {                                                 | orderBy: []                                 |
|    |                |              |     "exec": "853(us)",                                         | schemaId: 2                                 |
|    |                |              |     "host": "storaged1:9779",                                  | isEdge: false                               |
|    |                |              |     "storage_detail": {                                        | returnCols: [                               |
|    |                |              |       "IndexLimitNode(limit=9223372036854775807)": "1302(us)", |   "_vid"                                    |
|    |                |              |       "IndexProjectionNode(projectColumn=[_vid])": "1305(us)", | ]                                           |
|    |                |              |       "IndexVertexScanNode(IndexID=6, Path=())": "1299(us)"    | indexCtx: [                                 |
|    |                |              |     },                                                         |   {                                         |
|    |                |              |     "total": "1749(us)"                                        |     "columnHints": [],                      |
|    |                |              |   },                                                           |     "filter": "",                           |
|    |                |              |   "resp[2]": {                                                 |     "index_id": 6                           |
|    |                |              |     "exec": "662(us)",                                         |   }                                         |
|    |                |              |     "host": "storaged2:9779",                                  | ]                                           |
|    |                |              |     "storage_detail": {                                        |                                             |
|    |                |              |       "IndexLimitNode(limit=9223372036854775807)": "1323(us)", |                                             |
|    |                |              |       "IndexProjectionNode(projectColumn=[_vid])": "1317(us)", |                                             |
|    |                |              |       "IndexVertexScanNode(IndexID=6, Path=())": "1299(us)"    |                                             |
|    |                |              |     },                                                         |                                             |
|    |                |              |     "total": "2862(us)"                                        |                                             |
|    |                |              |   },                                                           |                                             |
|    |                |              |   "rows": 51,                                                  |                                             |
|    |                |              |   "totalTime": "4448(us)",                                     |                                             |
|    |                |              |   "version": 0                                                 |                                             |
|    |                |              | }                                                              |                                             |
-----+----------------+--------------+----------------------------------------------------------------+----------------------------------------------
|  2 | Start          |              | {                                                              | outputVar: {                                |
|    |                |              |   "execTime": "0(us)",                                         |   "colNames": [],                           |
|    |                |              |   "rows": 0,                                                   |   "type": "DATASET",                        |
|    |                |              |   "totalTime": "50(us)",                                       |   "name": "__Start_2"                       |
|    |                |              |   "version": 0                                                 | }                                           |
|    |                |              | }                                                              |                                             |
-----+----------------+--------------+----------------------------------------------------------------+----------------------------------------------

Fri, 01 Dec 2023 14:38:29 CST


我match 查询能查出来挂接的数据 到那时 fetch prop 却啥都没有 是我语句写错了吗

这个边存在么?你是 fetch 边,match 里查的是点

咱们现在的问题是没有点上的属性吧?你不是应该

FETCH PROP on `故障11日明细` 

么?


我fetch prop 这个点 他的日期属性也是有值的


为什么用日期查询 这个日期就不起作用呢 我日期是索引的啊

show tag indexes

执行下,然后把结果截图下。


我nebula2 nebula3空间的数据和 tag 代码都是一样的

lookup where 呢?这个验证一下索引数据,分别返回所有属性,和只返回日期



都有数据

  • 没有日期的是同一个 vid 的点?

要么是"故障12日明细"索引没有重建,要么是中文的 tag 和 prop 需要 ` 包裹

索引重建了 没有日期的是所有的关联查询出来的都没有 但是单个故障这个tag查出来是都有日期的

我想问一下 社区版的nebula 如果一个tag有208个属性 那么进行边查询的时候 如果资源很少 那么索引属性会不会出现没有数据的问题 单独查这个tag的时候 索引属性反而有数据呢

你是针对这 208 个属性都创建了单独的索引还是说对这个 tag 创建了一个索引?如果是后者的话,nebula 的索引是左匹配的,可能存在所有没有命中的问题。