Oracle 5.0 Reference Manual page 679

Table of Contents

Advertisement

NULL
1
NULL
2
1
1
1
1
1
2
2
1
The condition
key_part1 = 1
(1,-inf,-inf) <= (key_part1,key_part2,key_part3) < (1,+inf,+inf)
The interval covers the 4th, 5th, and 6th tuples in the preceding data set and can be used by the range
access method.
By contrast, the condition
by the range access method.
The following descriptions indicate how range conditions work for multiple-part indexes in greater
detail.
• For
indexes, each interval containing identical values can be used. This means that the interval
HASH
can be produced only for conditions in the following form:
key_part1 cmp const1
AND
key_part2 cmp const2
AND ...
AND
key_partN cmp
constN;
Here, const1, const2, ... are constants,
[877]
comparison operators, and the conditions cover all index parts. (That is, there are
NULL
conditions, one for each part of an N-part index.) For example, the following is a range condition for a
three-part
index:
HASH
key_part1
= 1 AND
key_part2
For the definition of what is considered to be a constant, see
Method for Single-Part
• For a
index, an interval might be usable for conditions combined with
BTREE
each condition compares a key part with a constant value using
[877],
[876],
NULL
>
or
LIKE 'pattern'
be used as long as it is possible to determine a single key tuple containing all rows that match the
condition (or two intervals if
The optimizer attempts to use additional key parts to determine the interval as long as the
comparison operator is
[876],
[876],
<
>=
<=
optimizer uses it but considers no more key parts. For the following expression, the optimizer
uses
[875]
from the first comparison. It also uses
=
considers no further key parts and does not use the third comparison for interval construction:
key_part1
= 'foo' AND
The single interval is:
('foo',10,-inf) < (key_part1,key_part2,key_part3) < ('foo',+inf,+inf)
It is possible that the created interval contains more rows than the initial condition. For example,
the preceding interval includes the value
condition.
• If conditions that cover sets of rows contained within intervals are combined with
they form a condition that covers a set of rows contained within the union of their intervals. If the
Optimizing
SELECT
'xyz'
'foo'
'abc'
'xyz'
'abc'
'aaa'
defines this interval:
key_part3 = 'abc'
cmp
IS NULL AND
key_part3
Indexes".
[876],
[876],
[876],
<
>=
<=
[896]
(where
'pattern'
[876]
or
[876]
<>
!=
[875],
[876], or
=
<=>
[876],
[876],
[876],
!=
<>
key_part2
>= 10 AND
('foo', 11,
659
Statements
does not define a single interval and cannot be used
is one of the
[875],
=
= 'foo'
Section 8.3.1.3.1, "The Range Access
[875],
=
[876],
[876],
!=
<>
BETWEEN
does not start with a wildcard). An interval can
is used).
[877]. If the operator is
IS NULL
[877], or
BETWEEN
LIKE
[876]
from the second comparison but
>=
key_part3
> 10
0), which does not satisfy the original
[876], or
<=>
IS
[880], where
AND
[876],
<=>
IS
[877],
[876],
>
[896], the
[881],
OR
N

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents