Oracle 5.0 Reference Manual page 695

Table of Contents

Advertisement

the
condition is not null-rejected for the embedded outer join, but the join condition of the
WHERE
embedding outer join
SELECT * FROM T1 LEFT JOIN
WHERE T3.D > 0 OR T1.D > 0
The algorithm that converts outer join operations into inner joins was implemented in full measure, as it
has been described here, in MySQL 5.0.1. MySQL 4.1 performs only some simple conversions.
8.3.1.11.
ORDER BY
In some cases, MySQL can use an index to satisfy an
sorting.
The index can also be used even if the
of the unused portions of the index and all the extra
clause. The following queries use the index to resolve the
SELECT * FROM t1
ORDER BY key_part1,key_part2,... ;
SELECT * FROM t1
WHERE
key_part1
ORDER BY key_part2;
SELECT * FROM t1
ORDER BY
key_part1
SELECT * FROM t1
WHERE
key_part1
ORDER BY
key_part1
SELECT * FROM t1
WHERE
key_part1
ORDER BY
key_part1
SELECT * FROM t1
WHERE
key_part1
ORDER BY
key_part1
SELECT * FROM t1
WHERE
key_part1
ORDER BY key_part2;
In some cases, MySQL cannot use indexes to resolve the
find the rows that match the
• You use
ORDER BY
SELECT * FROM t1 ORDER BY key1, key2;
• You use
ORDER BY
SELECT * FROM t1 WHERE
• You mix
ASC
SELECT * FROM t1 ORDER BY
• The key used to fetch the rows is not the same as the one used in the
SELECT * FROM t1 WHERE
• You use
ORDER BY
SELECT * FROM t1 ORDER BY ABS(key);
Optimizing
T2.A=T1.A AND T3.C=T1.C
(T2, T3)
ON T2.A=T1.A AND T3.C=T1.C AND T3.B=T2.B
Optimization
=
constant
DESC,
key_part2
= 1
DESC,
key_part2
>
constant
ASC;
<
constant
DESC;
=
constant1
AND
key_part2
clause. These cases include the following:
WHERE
on different keys:
on nonconsecutive parts of a key:
key2=constant
and DESC:
key_part1
key2=constant
with an expression that includes terms other than the key column name:
Statements
SELECT
is null-rejected. So the query can be converted to:
ORDER BY
does not match the index exactly, as long as all
ORDER BY
ORDER BY
ORDER BY
DESC;
DESC;
>
constant2
ORDER
ORDER BY key_part2;
DESC,
key_part2
ASC;
ORDER BY key1;
675
clause without doing any extra
columns are constants in the
part:
BY, although it still uses indexes to
ORDER
BY:
WHERE

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents