你的语句里有 order by ,这样需要先排序在取top n,应该是合并不了。
如果把order by 去掉,limit 会在TagIndexRangeScan里。
(root@nebula) [nba]> explain LOOKUP ON player WHERE player.age >= 0 and player.age < 100 YIELD id(VERTEX) as id, properties(vertex).age as age | LIMIT 20
Execution succeeded (time spent 4180/5071 us)
Execution Plan (optimize time 2998 us)
-----+-------------------+--------------+----------------+------------------------------------
| id | name | dependencies | profiling data | operator info |
-----+-------------------+--------------+----------------+------------------------------------
| 7 | Project | 8 | | outputVar: { |
| | | | | "colNames": [ |
| | | | | "id", |
| | | | | "age" |
| | | | | ], |
| | | | | "name": "__Limit_4", |
| | | | | "type": "DATASET" |
| | | | | } |
| | | | | inputVar: __Limit_6 |
| | | | | columns: [ |
| | | | | "id(VERTEX) AS id", |
| | | | | "properties(VERTEX).age AS age" |
| | | | | ] |
-----+-------------------+--------------+----------------+------------------------------------
| 8 | Limit | 9 | | outputVar: { |
| | | | | "colNames": [ |
| | | | | "_vid", |
| | | | | "player._tag", |
| | | | | "player.age", |
| | | | | "player.name" |
| | | | | ], |
| | | | | "name": "__Limit_6", |
| | | | | "type": "DATASET" |
| | | | | } |
| | | | | inputVar: __TagIndexRangeScan_9 |
| | | | | offset: 0 |
| | | | | count: 20 |
-----+-------------------+--------------+----------------+------------------------------------
| 9 | TagIndexRangeScan | 0 | | outputVar: { |
| | | | | "colNames": [ |
| | | | | "_vid", |
| | | | | "player._tag", |
| | | | | "player.age", |
| | | | | "player.name" |
| | | | | ], |
| | | | | "type": "DATASET", |
| | | | | "name": "__TagIndexRangeScan_9" |
| | | | | } |
| | | | | inputVar: |
| | | | | space: 7 |
| | | | | dedup: false |
| | | | | limit: 20 |
| | | | | filter: |
| | | | | orderBy: [] |
| | | | | schemaId: 8 |
| | | | | isEdge: false |
| | | | | returnCols: [ |
| | | | | "_vid", |
| | | | | "_tag", |
| | | | | "age", |
| | | | | "name" |
| | | | | ] |
| | | | | indexCtx: [ |
| | | | | { |
| | | | | "columnHints": [ |
| | | | | { |
| | | | | "includeEnd": false, |
| | | | | "endValue": 100, |
| | | | | "beginValue": 0, |
| | | | | "includeBegin": true, |
| | | | | "column": "age", |
| | | | | "scanType": "RANGE" |
| | | | | } |
| | | | | ], |
| | | | | "filter": "", |
| | | | | "index_id": 15 |
| | | | | } |
| | | | | ] |
-----+-------------------+--------------+----------------+------------------------------------
| 0 | Start | | | outputVar: { |
| | | | | "colNames": [], |
| | | | | "type": "DATASET", |
| | | | | "name": "__Start_0" |
| | | | | } |
-----+-------------------+--------------+----------------+------------------------------------