You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: optimizer-hints.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -135,19 +135,19 @@ select /*+ HASH_JOIN(t1, t2) */ * from t1, t2 where t1.id = t2.id;
135
135
136
136
### SEMI_JOIN_REWRITE()
137
137
138
-
The `SEMI_JOIN_REWRITE()` hint tells the optimizer to rewrite the semijoin query to an ordinary join query. Currently, this hint only works for `EXISTS` subqueries.
138
+
The `SEMI_JOIN_REWRITE()` hint tells the optimizer to rewrite the semi-join query to an ordinary join query. Currently, this hint only works for `EXISTS` subqueries.
139
139
140
-
If this hint is not used to rewrite the query, when the hash join is selected in the execution plan, the semijoin query can only use the subquery to build a hash table. In this case, when the result set of the subquery is bigger than that of the outer query, the execution speed might be slower than expected.
140
+
If this hint is not used to rewrite the query, when the hash join is selected in the execution plan, the semi-join query can only use the subquery to build a hash table. In this case, when the result of the subquery is bigger than that of the outer query, the execution speed might be slower than expected.
141
141
142
-
Similarly, when the index join is selected in the execution plan, the semijoin query can only use the outer query as the driving table. In this case, when the result set of the subquery is smaller than that of the outer query, the execution speed might be slower than expected.
142
+
Similarly, when the index join is selected in the execution plan, the semi-join query can only use the outer query as the driving table. In this case, when the result of the subquery is smaller than that of the outer query, the execution speed might be slower than expected.
143
143
144
144
When `SEMI_JOIN_REWRITE()` is used to rewrite the query, the optimizer can extend the selection range to select a better execution plan.
145
145
146
146
{{< copyable "sql" >}}
147
147
148
148
```sql
149
149
-- Does not use SEMI_JOIN_REWRITE() to rewrite the query.
150
-
EXPLAIN SELECT*FROM t WHERE EXISTS (SELECT1from t1 wheret1.a=t.a);
150
+
EXPLAIN SELECT*FROM t WHERE EXISTS (SELECT1FROM t1 WHEREt1.a=t.a);
151
151
```
152
152
153
153
```sql
@@ -166,7 +166,7 @@ EXPLAIN SELECT * FROM t WHERE EXISTS (SELECT 1 from t1 where t1.a=t.a);
166
166
167
167
```sql
168
168
-- Uses SEMI_JOIN_REWRITE() to rewrite the query.
169
-
EXPLAIN SELECT*FROM t WHERE EXISTS (SELECT/*+ SEMI_JOIN_REWRITE() */1from t1 wheret1.a=t.a);
169
+
EXPLAIN SELECT*FROM t WHERE EXISTS (SELECT/*+ SEMI_JOIN_REWRITE() */1FROM t1 WHEREt1.a=t.a);
Copy file name to clipboardExpand all lines: subquery-optimization.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -89,8 +89,8 @@ explain select * from t where exists (select * from t2);
89
89
90
90
In the preceding optimization, the optimizer automatically optimizes the statement execution. In addition, you can also add the [`SEMI_JOIN_REWRITE`](/optimizer-hints.md#semi_join_rewrite) hint to further rewrite the statement.
91
91
92
-
If this hint is not used to rewrite the query, when the hash join is selected in the execution plan, the semijoin query can only use the subquery to build a hash table. In this case, when the result set of the subquery is bigger than that of the outer query, the execution speed might be slower than expected.
92
+
If this hint is not used to rewrite the query, when the hash join is selected in the execution plan, the semi-join query can only use the subquery to build a hash table. In this case, when the result of the subquery is bigger than that of the outer query, the execution speed might be slower than expected.
93
93
94
-
Similarly, when the index join is selected in the execution plan, the semijoin query can only use the outer query as the driving table. In this case, when the result set of the subquery is smaller than that of the outer query, the execution speed might be slower than expected.
94
+
Similarly, when the index join is selected in the execution plan, the semi-join query can only use the outer query as the driving table. In this case, when the result of the subquery is smaller than that of the outer query, the execution speed might be slower than expected.
95
95
96
96
When `SEMI_JOIN_REWRITE()` is used to rewrite the query, the optimizer can extend the selection range to select a better execution plan.
0 commit comments