Details
-
Task
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
None
-
None
Description
Suppose we're running
t1 full outer join t2 on on_expr |
and we use join buffer.
The first step is to read rows from t1 and put them into join buffer:
join_buffer
|
t1.recordX, match_flag=false
|
t1.recordY, match_flag=false
|
t1.recordZ, match_flag=false
|
Suppose the join buffer is large enough and all records from t1 fit there.
Then we do joining. I am providing existing LEFT JOIN algorithm, comments show how we can add FULL JOIN easily:
for each record R2 in t2 { |
|
for each record R1 from join buffer { |
if (on_expr(R1, R2)) |
emit(R1.t1_record, R2);
|
}
|
|
|
// If the above loop didn't produce anything, we know |
// that R2 didn't have a match. |
// So, we can do: |
// emit(t1.null_complemented_record, R2); |
}
|
|
|
for each record R1 in join_buffer { |
if (R1.match_flag == false) |
emit(R1.t1_record, t2.null_complemented_record);
|
}
|
Note that this doesn't require a temporary table, or any extra space in the join buffer.
The only condition is that all the matching rows from the first table fit into the join buffer.
Attachments
Issue Links
- relates to
-
MDEV-39014 FULL JOIN Algorithm, Phase 2
-
- In Review
-