EXPLAIN
Output Format
647
ref
[646]
can be used for indexed columns that are compared using the
=
or
<=>
operator. In the
following examples, MySQL can use a
ref
[646]
join to process
ref_table
:
SELECT * FROM
ref_table
WHERE
key_column
=
expr
;
SELECT * FROM
ref_table
,
other_table
WHERE
ref_table
.
key_column
=
other_table
.
column
;
SELECT * FROM
ref_table
,
other_table
WHERE
ref_table
.
key_column_part1
=
other_table
.
column
AND
ref_table
.
key_column_part2
=1;
•
fulltext
[647]
The join is performed using a
FULLTEXT
index.
•
ref_or_null
[647]
This join type is like
ref
[646]
, but with the addition that MySQL does an extra search for rows that
contain
NULL
values. This join type optimization is used most often in resolving subqueries. In the
following examples, MySQL can use a
ref_or_null
[647]
join to process
ref_table
:
SELECT * FROM
ref_table
WHERE
key_column
=
expr
OR
key_column
IS NULL;
See
Section 8.3.1.6, “
IS NULL
Optimization”
.
•
index_merge
[647]
This join type indicates that the Index Merge optimization is used. In this case, the
key
column in the
output row contains a list of indexes used, and
key_len
contains a list of the longest key parts for
the indexes used. For more information, see
Section 8.3.1.4, “Index Merge Optimization”
.
•
unique_subquery
[647]
This type replaces
ref
[646]
for some
IN
subqueries of the following form:
value
IN (SELECT
primary_key
FROM
single_table
WHERE
some_expr
)
unique_subquery
[647]
is just an index lookup function that replaces the subquery completely
for better efficiency.
•
index_subquery
[647]
This join type is similar to
unique_subquery
[647]
. It replaces
IN
subqueries, but it works for
nonunique indexes in subqueries of the following form:
value
IN (SELECT
key_column
FROM
single_table
WHERE
some_expr
)
•
range
[647]
Only rows that are in a given range are retrieved, using an index to select the rows. The
key
column
in the output row indicates which index is used. The
key_len
contains the longest key part that was
used. The
ref
column is
NULL
for this type.
range
[647]
can be used when a key column is compared to a constant using any of the
=
[875]
,
<>
[876]
,
>
[876]
,
>=
[876]
,
<
[876]
,
<=
[876]
,
IS NULL
[877]
,
<=>
[876]
,
BETWEEN
[877]
, or
IN()
[878]
operators:
SELECT * FROM
tbl_name
WHERE
key_column
= 10;
SELECT * FROM
tbl_name
WHERE
key_column
BETWEEN 10 and 20;
Summary of Contents for 5.0
Page 1: ...MySQL 5 0 Reference Manual ...
Page 18: ...xviii ...
Page 60: ...40 ...
Page 396: ...376 ...
Page 578: ...558 ...
Page 636: ...616 ...
Page 844: ...824 ...
Page 1234: ...1214 ...
Page 1427: ...MySQL Proxy Scripting 1407 ...
Page 1734: ...1714 ...
Page 1752: ...1732 ...
Page 1783: ...Configuring Connector ODBC 1763 ...
Page 1793: ...Connector ODBC Examples 1773 ...
Page 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Page 2850: ...2830 ...
Page 2854: ...2834 ...
Page 2928: ...2908 ...
Page 3000: ...2980 ...
Page 3122: ...3102 ...
Page 3126: ...3106 ...
Page 3174: ...3154 ...
Page 3232: ...3212 ...