Skip to content

Commit

Permalink
Fix description error in explain-subqueries.md (#7856)
Browse files Browse the repository at this point in the history
  • Loading branch information
yiwen92 authored Dec 8, 2021
1 parent 7a8f5d4 commit 8e244d5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion explain-subqueries.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ EXPLAIN SELECT * FROM t1 WHERE id IN (SELECT t1_id FROM t2);
8 rows in set (0.00 sec)
```

由上述查询结果可知,TiDB 首先执行 `Index Join` 索引连接操作,开始读取 `t2.t1_id` 列的索引。先是 `└─HashAgg_31` 算子的部分任务在 TiKV 中对 `t1_id` 值进行去重,然后`├─HashAgg_38(Build)` 算子的部分任务在 TiDB 中对 `t1_id` 值再次进行去重去重操作由聚合函数 `firstrow(test.t2.t1_id)` 执行,之后会将操作结果与 `t1` 表的主键相连接。
由上述查询结果可知,TiDB 通过索引连接操作 `| IndexJoin_14` 将子查询做了连接转化。该执行计划首先在 TiKV 侧通过索引扫描算子 `└─IndexFullScan_31` 读取 `t2.t1_id` 列的值,然后由 `└─StreamAgg_39` 算子的部分任务在 TiKV 中对 `t1_id` 值进行去重,然后采用 `├─StreamAgg_49(Build)` 算子的部分任务在 TiDB 中对 `t1_id` 值再次进行去重去重操作由聚合函数 `firstrow(test.t2.t1_id)` 执行;之后将操作结果与 `t1` 表的主键相连接,连接条件是 `eq(test.t1.id, test.t2.t1_id)`

## Inner join(有 `UNIQUE` 约束的子查询)

Expand Down

0 comments on commit 8e244d5

Please sign in to comment.