Skip to content

Commit

Permalink
doc: update the doc for hash_join_build and hash_join_probe hints (#1…
Browse files Browse the repository at this point in the history
…1276)

* doc: update the doc for hash_join_build and hash_join_probe hints

* Update optimizer-hints.md

Co-authored-by: TomShawn <41534398+TomShawn@users.noreply.github.com>

* Update optimizer-hints.md

Co-authored-by: TomShawn <41534398+TomShawn@users.noreply.github.com>

* Update optimizer-hints.md

Co-authored-by: TomShawn <41534398+TomShawn@users.noreply.github.com>

Co-authored-by: Yuanjia Zhang <qw4990@163.com>
Co-authored-by: TomShawn <41534398+TomShawn@users.noreply.github.com>
  • Loading branch information
3 people authored Sep 16, 2022
1 parent d2ae618 commit 60ecd12
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions optimizer-hints.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,22 @@ SELECT /*+ HASH_JOIN(t1, t2) */ * FROM t1, t2 WHERE t1.id = t2.id;
>
> `HASH_JOIN` 的别名是 `TIDB_HJ`,在 3.0.x 及之前版本仅支持使用该别名;之后的版本同时支持使用这两种名称,推荐使用 `HASH_JOIN`
### HASH_JOIN_BUILD(t1_name [, tl_name ...])

`HASH_JOIN_BUILD(t1_name [, tl_name ...])` 提示优化器对指定表使用 Hash Join 算法,同时将指定表作为 Hash Join 算法的 Build 端,即用指定表来构建哈希表。例如:

```sql
SELECT /*+ HASH_JOIN_BUILD(t1) */ * FROM t1, t2 WHERE t1.id = t2.id;
```

### HASH_JOIN_PROBE(t1_name [, tl_name ...])

`HASH_JOIN_PROBE(t1_name [, tl_name ...])` 提示优化器对指定表使用 Hash Join 算法,同时将指定表作为 Hash Join 算法的探测(Probe)端,即用指定表作为探测端来执行 Hash Join 算法。例如:

```sql
SELECT /*+ HASH_JOIN_PROBE(t2) */ * FROM t1, t2 WHERE t1.id = t2.id;
```

### SEMI_JOIN_REWRITE()

`SEMI_JOIN_REWRITE()` 提示优化器将查询语句中的半连接 (Semi Join) 改写为普通的内连接。目前该 Hint 只作用于 `EXISTS` 子查询。
Expand Down

0 comments on commit 60ecd12

Please sign in to comment.