Oracle 5.0 Reference Manual page 680

Table of Contents

Advertisement

conditions are combined with
within the intersection of their intervals. For example, for this condition on a two-part index:
(key_part1
The intervals are:
(1,-inf) < (key_part1,key_part2) < (1,2)
(5,-inf) < (key_part1,key_part2)
In this example, the interval on the first line uses one key part for the left bound and two key parts for
the right bound. The interval on the second line uses only one key part. The
EXPLAIN
In some cases,
would expect. Suppose that
displays two key part lengths for the following condition:
key_part1
But, in fact, the condition is converted to this:
key_part1
Section 8.3.1.3.1, "The Range Access Method for Single-Part
are performed to combine or eliminate intervals for range conditions on a single-part index. Analogous
steps are performed for range conditions on multiple-part indexes.
8.3.1.4. Index Merge Optimization
The Index Merge method is used to retrieve rows with several
their results into one. The merge can produce unions, intersections, or unions-of-intersections of its
underlying scans. This access method merges index scans from a single table; it does not merge
scans across multiple tables.
In
EXPLAIN
this case, the
key parts for those indexes.
Examples:
SELECT * FROM
SELECT * FROM
WHERE
(key1
SELECT * FROM t1, t2
WHERE
(t1.key1
AND t2.key1=t1.some_col;
SELECT * FROM t1, t2
WHERE t1.key1=1
AND
(t2.key1=t1.some_col
The Index Merge method has several access algorithms (seen in the
Using intersect(...)
Optimizing
AND
= 1 AND
key_part2
< 2) OR
output indicates the maximum length of the key prefix used.
may indicate that a key part was used, but that might be not what you
key_len
key_part1
>= 1 AND
key_part2
< 2
>= 1 AND
key_part2
IS NOT NULL
Note
If you have upgraded from a previous version of MySQL, you should be
aware that this type of join optimization is first introduced in MySQL 5.0, and
represents a significant change in behavior with regard to indexes. (Formerly,
MySQL was able to use at most only one index for each referenced table.)
output, the Index Merge method appears as
column contains a list of indexes used, and
key
tbl_name
WHERE
key1
tbl_name
= 10 OR
key2
= 20) AND non_key=30;
IN (1,2) OR
t1.key2
OR t2.key2=t1.some_col2);
Statements
SELECT
[880], they form a condition that covers a set of rows contained
(key_part1
> 5)
and
key_part2
index_merge
= 10 OR
key2
= 20;
LIKE 'value%')
660
key_len
can be NULL. Then the
Indexes", describes how optimizations
[647]
scans and to merge
range
[647]
in the
contains a list of the longest
key_len
field of
Extra
column in the
column
key_len
column. In
type
output):
EXPLAIN

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents