Oracle 5.0 Reference Manual page 687

Table of Contents

Advertisement

For the example join described previously for the NLJ algorithm (without buffering), the join is done as
follow using join buffering:
for each row in t1 matching range {
for each row in t2 matching reference key {
store used columns from t1, t2 in join buffer
if buffer is full {
for each row in t3 {
for each t1, t2 combination in join buffer {
if row satisfies join conditions,
send to client
}
}
empty buffer
}
}
}
if buffer is not empty {
for each row in t3 {
for each t1, t2 combination in join buffer {
if row satisfies join conditions,
send to client
}
}
}
If
is the size of each stored t1,
S
in the buffer, the number of times table
(S
* C)/join_buffer_size + 1
The number of
point when
join_buffer_size
point, there is no speed to be gained by making it larger.
8.3.1.9. Nested Join Optimization
As of MySQL 5.0.1, the syntax for expressing joins permits nested joins. The following discussion
refers to the join syntax described in
The syntax of
only table_reference, not a list of them inside a pair of parentheses. This is a conservative
extension if we consider each comma in a list of
join. For example:
SELECT * FROM t1 LEFT JOIN (t2, t3, t4)
is equivalent to:
SELECT * FROM t1 LEFT JOIN (t2 CROSS JOIN t3 CROSS JOIN t4)
In MySQL,
CROSS JOIN
standard SQL, they are not equivalent.
otherwise.
In versions of MySQL prior to 5.0.1, parentheses in
join operations were grouped to the left. In general, parentheses can be ignored in join expressions
containing only inner join operations.
After removing parentheses and grouping operations to the left, the join expression:
t1 LEFT JOIN (t2 LEFT JOIN t3 ON t2.b=t3.b OR t2.b IS NULL)
Optimizing
combination is the join buffer and
t2
scans decreases as the value of
t3
[457]
Section 13.2.8.2,
is extended in comparison with the SQL Standard. The latter accepts
table_factor
ON (t2.a=t1.a AND t3.b=t1.b AND t4.c=t1.c)
ON (t2.a=t1.a AND t3.b=t1.b AND t4.c=t1.c)
is a syntactic equivalent to
Statements
SELECT
is scanned is:
t3
join_buffer_size
is large enough to hold all previous row combinations. At that
"JOIN
Syntax".
table_reference
INNER JOIN
is used with an
INNER JOIN
table_references
667
is the number of combinations
C
[457]
increases, up to the
items as equivalent to an inner
(they can replace each other). In
clause;
ON
CROSS JOIN
were just omitted and all
is used

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents