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: docs/sql/query-syntax/query-syntax-join-clause.md
+42-6
Original file line number
Diff line number
Diff line change
@@ -112,7 +112,7 @@ ON s1.id = s2.id and s1.window_start = s2.window_start;
112
112
113
113
## Interval joins
114
114
115
-
Window joins require that the two sources have the same window type and window size. This requirement can be too strict in some scenarios. If you want to join two sources that have some time offset, you can create an interval join by specifying an accepted internval range based on watermarks.
115
+
Window joins require that the two sources have the same window type and window size. This requirement can be too strict in some scenarios. If you want to join two sources that have some time offset, you can create an interval join by specifying an accepted interval range based on watermarks.
116
116
117
117
The syntax of an interval join is:
118
118
@@ -136,23 +136,27 @@ ON s1.id = s2.id and s1.ts between s2.ts and s2.ts + INTERVAL '1' MINUTE;
136
136
137
137
## Process-time temporal joins
138
138
139
-
A temporal join is often used to widen a fact table. Its advantage is that it does not require RisingWave to maintain the join state, making it suitable for scenarios where the dimension table is not updated, or where updates to the dimension table do not affect the previously joined results. To further improve performance, you can use the index of a dimension table to form a join with the fact table.
139
+
Process-time temporal joins are divided into two categories: append-only process-time temporal join and non-append-only process-time temporal join. Check the following instructions for their differences.
140
140
141
-
### Syntax
141
+
### Append-only process-time temporal join
142
+
143
+
An append-only temporal join is often used to widen a fact table. Its advantage is that it does not require RisingWave to maintain the join state, making it suitable for scenarios where the dimension table is not updated, or where updates to the dimension table do not affect the previously joined results. To further improve performance, you can use the index of a dimension table to form a join with the fact table.
144
+
145
+
#### Syntax
142
146
143
147
```sql
144
148
<table_expression> [ LEFT | INNER ] JOIN<table_expression> FOR SYSTEM_TIME AS OF PROCTIME() ON<join_conditions>;
145
149
```
146
150
147
-
### Notes
151
+
####Notes
148
152
149
153
- The left table expression is an append-only table or source.
150
154
- The right table expression is a table, index or materialized view.
151
155
- The process-time syntax `FOR SYSTEM_TIME AS OF PROCTIME()` is included in the right table expression.
152
156
- The join type is INNER JOIN or LEFT JOIN.
153
157
- The Join condition includes the primary key of the right table expression.
154
158
155
-
### Example
159
+
####Example
156
160
157
161
If you have an append-only stream that includes messages like below:
158
162
@@ -179,11 +183,43 @@ You can use a temporal join to fetch the latest product name and price from the
Compared to the append-only temporal join, the non-append-only temporal join can accommodate non-append-only input for the left table. However, it introduces an internal state to materialize the lookup result for each left-hand side (LHS) insertion. This allows the temporal join operator to retract the join result it sends downstream when update or delete messages arrive.
198
+
199
+
#### Syntax
200
+
201
+
The non-append-only temporal join shares the same syntax as the append-only temporal join.
202
+
203
+
```sql
204
+
<table_expression> [ LEFT | INNER ] JOIN<table_expression> FOR SYSTEM_TIME AS OF PROCTIME() ON<join_conditions>;
0 commit comments