Hi <@U01PEPAAR7B> and <@U0440TH687L> Today I look...
# nebula
w
Hi @Goran Cvijanovic and @Sơn Trần Thái Today I looked into this expression, to know this is an issue on optimizer, where the filter condition is not added in indexscan, which end up full scan of whole tag data.
Copy code
(root@nebula) [basketballplayer]> explain match (v:player) where v.player.name in ["Tim Duncan"] return v limit 1
Execution succeeded (time spent 940/6819 us)

Execution Plan (optimize time 328 us)
...
-----+----------------+--------------+----------------+-----------------------------------------------
|  1 | IndexScan      | 2            |                | outputVar: {                                 |
|    |                |              |                |   "colNames": [                              |
|    |                |              |                |     "_vid"                                   |
|    |                |              |                |   ],                                         |
|    |                |              |                |   "type": "DATASET",                         |
|    |                |              |                |   "name": "__IndexScan_1"                    |
|    |                |              |                | }                                            |
|    |                |              |                | inputVar:                                    |
|    |                |              |                | space: 49                                    |
|    |                |              |                | dedup: false                                 |
|    |                |              |                | limit: 9223372036854775807                   |
|    |                |              |                | filter:                                      |
|    |                |              |                | orderBy: []                                  |
|    |                |              |                | schemaId: 50                                 |
|    |                |              |                | isEdge: false                                |
|    |                |              |                | returnCols: [                                |
|    |                |              |                |   "_vid"                                     |
|    |                |              |                | ]                                            |
|    |                |              |                | indexCtx: [                                  |
|    |                |              |                |   {                                          |
|    |                |              |                |     "columnHints": [],                       |
|    |                |              |                |     "filter": "",                            |
|    |                |              |                |     "index_id": 54                           |
|    |                |              |                |   }                                          |
|    |                |              |                | ]                                            |
-----+----------------+--------------+----------------+-----------------------------------------------
...
Copy code
(root@nebula) [basketballplayer]> explain match (v:player) where v.player.name == "Tim Duncan" return v limit 1
Execution succeeded (time spent 1069/6613 us)
...
|    |                |              |                | if_track_previous_path: false            |
-----+----------------+--------------+----------------+-------------------------------------------
|  8 | IndexScan      | 2            |                | outputVar: {                             |
|    |                |              |                |   "colNames": [                          |
|    |                |              |                |     "_vid"                               |
|    |                |              |                |   ],                                     |
|    |                |              |                |   "type": "DATASET",                     |
|    |                |              |                |   "name": "__IndexScan_1"                |
|    |                |              |                | }                                        |
|    |                |              |                | inputVar:                                |
|    |                |              |                | space: 49                                |
|    |                |              |                | dedup: false                             |
|    |                |              |                | limit: 9223372036854775807               |
|    |                |              |                | filter:                                  |
|    |                |              |                | orderBy: []                              |
|    |                |              |                | schemaId: 50                             |
|    |                |              |                | isEdge: false                            |
|    |                |              |                | returnCols: [                            |
|    |                |              |                |   "_vid"                                 |
|    |                |              |                | ]                                        |
|    |                |              |                | indexCtx: [                              |
|    |                |              |                |   {                                      |
|    |                |              |                |     "columnHints": [                     |
|    |                |              |                |       {                                  |
|    |                |              |                |         "includeEnd": false,             |
|    |                |              |                |         "includeBegin": true,            |
|    |                |              |                |         "endValue": "__EMPTY__",         |
|    |                |              |                |         "beginValue": "Tim Duncan",      |
|    |                |              |                |         "scanType": "PREFIX",            |
|    |                |              |                |         "column": "name"                 |
|    |                |              |                |       }                                  |
|    |                |              |                |     ],                                   |
|    |                |              |                |     "filter": "",                        |
|    |                |              |                |     "index_id": 55                       |
|    |                |              |                |   }                                      |
|    |                |              |                | ]                                        |
-----+----------------+--------------+----------------+-------------------------------------------
The mitigation now is to use
==
instead of
IN
I had reported this https://github.com/vesoft-inc/nebula/issues/4708 Thanks!