Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
f96d57d3
Commit
f96d57d3
authored
Aug 08, 2003
by
serg@serg.mylan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
between tests added
bugfixes will follow
parent
e56383ef
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
0 deletions
+45
-0
mysql-test/r/range.result
mysql-test/r/range.result
+28
-0
mysql-test/t/range.test
mysql-test/t/range.test
+17
-0
No files found.
mysql-test/r/range.result
View file @
f96d57d3
...
...
@@ -226,3 +226,31 @@ insert into t1 values (0,1,NULL,"aaa"), (1,1,NULL,"aaa"), (2,1,NULL,"aaa"),
select a.id1, b.idnull from t1 as a, t1 as b where a.id2=1 and a.id1=1 and b.id1=a.idnull order by b.id2 desc limit 1;
id1 idnull
drop table t1;
create table t1 (x int, y int, index(x), index(y));
insert into t1 (x) values (1),(2),(3),(4),(5),(6),(7),(8),(9);
update t1 set y=x;
explain select * from t1, t1 t2 where t1.y = 2 and t2.x between 7 and t1.y+0;
table type possible_keys key key_len ref rows Extra
t1 ref y y 5 const 1 Using where
t2 ALL x NULL NULL NULL 9 Using where
explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= 7 and t2.x <= t1.y+0;
table type possible_keys key key_len ref rows Extra
t1 ref y y 5 const 1 Using where
t2 range x x 5 NULL 4 Using where
explain select * from t1, t1 t2 where t1.y = 2 and t2.x between t1.y-1 and t1.y+1;
table type possible_keys key key_len ref rows Extra
t1 ref y y 5 const 1 Using where
t2 ALL x NULL NULL NULL 9 Using where
explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= t1.y-1 and t2.x <= t1.y+1;
table type possible_keys key key_len ref rows Extra
t1 ref y y 5 const 1 Using where
t2 ALL x NULL NULL NULL 9 Range checked for each record (index map: 1)
explain select * from t1, t1 t2 where t1.y = 2 and t2.x between 0 and t1.y;
table type possible_keys key key_len ref rows Extra
t1 ref y y 5 const 1 Using where
t2 ALL x NULL NULL NULL 9 Using where
explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= 0 and t2.x <= t1.y;
table type possible_keys key key_len ref rows Extra
t1 ref y y 5 const 1 Using where
t2 range x x 5 NULL 2 Using where
drop table t1;
mysql-test/t/range.test
View file @
f96d57d3
...
...
@@ -183,3 +183,20 @@ insert into t1 values (0,1,NULL,"aaa"), (1,1,NULL,"aaa"), (2,1,NULL,"aaa"),
select
a
.
id1
,
b
.
idnull
from
t1
as
a
,
t1
as
b
where
a
.
id2
=
1
and
a
.
id1
=
1
and
b
.
id1
=
a
.
idnull
order
by
b
.
id2
desc
limit
1
;
drop
table
t1
;
#
# BETWEEN problems
#
create
table
t1
(
x
int
,
y
int
,
index
(
x
),
index
(
y
));
insert
into
t1
(
x
)
values
(
1
),(
2
),(
3
),(
4
),(
5
),(
6
),(
7
),(
8
),(
9
);
update
t1
set
y
=
x
;
# between with only one end fixed
explain
select
*
from
t1
,
t1
t2
where
t1
.
y
=
2
and
t2
.
x
between
7
and
t1
.
y
+
0
;
explain
select
*
from
t1
,
t1
t2
where
t1
.
y
=
2
and
t2
.
x
>=
7
and
t2
.
x
<=
t1
.
y
+
0
;
# between with both expressions on both ends
explain
select
*
from
t1
,
t1
t2
where
t1
.
y
=
2
and
t2
.
x
between
t1
.
y
-
1
and
t1
.
y
+
1
;
explain
select
*
from
t1
,
t1
t2
where
t1
.
y
=
2
and
t2
.
x
>=
t1
.
y
-
1
and
t2
.
x
<=
t1
.
y
+
1
;
# equation propagation
explain
select
*
from
t1
,
t1
t2
where
t1
.
y
=
2
and
t2
.
x
between
0
and
t1
.
y
;
explain
select
*
from
t1
,
t1
t2
where
t1
.
y
=
2
and
t2
.
x
>=
0
and
t2
.
x
<=
t1
.
y
;
drop
table
t1
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment