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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
76aee430
Commit
76aee430
authored
Aug 11, 2010
by
Martin Hansson
Browse files
Options
Browse Files
Download
Plain Diff
Merge of fix for Bug#54444.
parents
59c59c7a
a89224ba
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
85 additions
and
85 deletions
+85
-85
mysql-test/r/partition_range.result
mysql-test/r/partition_range.result
+44
-0
mysql-test/r/range.result
mysql-test/r/range.result
+0
-44
mysql-test/t/partition_range.test
mysql-test/t/partition_range.test
+41
-0
mysql-test/t/range.test
mysql-test/t/range.test
+0
-41
No files found.
mysql-test/r/partition_range.result
View file @
76aee430
...
@@ -938,3 +938,47 @@ select sum(count) from t2 ch where ch.defid in (50,52) and ch.day between 200703
...
@@ -938,3 +938,47 @@ select sum(count) from t2 ch where ch.defid in (50,52) and ch.day between 200703
sum(count)
sum(count)
579
579
drop table t1, t2;
drop table t1, t2;
#
# Bug#50939: Loose Index Scan unduly relies on engine to remember range
# endpoints
#
CREATE TABLE t1 (
a INT,
b INT,
KEY ( a, b )
) PARTITION BY HASH (a) PARTITIONS 1;
CREATE TABLE t2 (
a INT,
b INT,
KEY ( a, b )
);
INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5);
INSERT INTO t1 SELECT a + 5, b + 5 FROM t1;
INSERT INTO t1 SELECT a + 10, b + 10 FROM t1;
INSERT INTO t1 SELECT a + 20, b + 20 FROM t1;
INSERT INTO t1 SELECT a + 40, b + 40 FROM t1;
INSERT INTO t2 SELECT * FROM t1;
# plans should be identical
EXPLAIN SELECT a, MAX(b) FROM t1 WHERE a IN (10,100) GROUP BY a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range a a 5 NULL 1 Using where; Using index for group-by
EXPLAIN SELECT a, MAX(b) FROM t2 WHERE a IN (10,100) GROUP BY a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range a a 5 NULL 2 Using where; Using index for group-by
FLUSH status;
SELECT a, MAX(b) FROM t1 WHERE a IN (10, 100) GROUP BY a;
a MAX(b)
10 10
# Should be no more than 4 reads.
SHOW status LIKE 'handler_read_key';
Variable_name Value
Handler_read_key 4
FLUSH status;
SELECT a, MAX(b) FROM t2 WHERE a IN (10, 100) GROUP BY a;
a MAX(b)
10 10
# Should be no more than 4 reads.
SHOW status LIKE 'handler_read_key';
Variable_name Value
Handler_read_key 4
DROP TABLE t1, t2;
mysql-test/r/range.result
View file @
76aee430
...
@@ -1653,48 +1653,4 @@ a b
...
@@ -1653,48 +1653,4 @@ a b
0 0
0 0
1 1
1 1
DROP TABLE t1;
DROP TABLE t1;
#
# Bug#50939: Loose Index Scan unduly relies on engine to remember range
# endpoints
#
CREATE TABLE t1 (
a INT,
b INT,
KEY ( a, b )
) PARTITION BY HASH (a) PARTITIONS 1;
CREATE TABLE t2 (
a INT,
b INT,
KEY ( a, b )
);
INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5);
INSERT INTO t1 SELECT a + 5, b + 5 FROM t1;
INSERT INTO t1 SELECT a + 10, b + 10 FROM t1;
INSERT INTO t1 SELECT a + 20, b + 20 FROM t1;
INSERT INTO t1 SELECT a + 40, b + 40 FROM t1;
INSERT INTO t2 SELECT * FROM t1;
# plans should be identical
EXPLAIN SELECT a, MAX(b) FROM t1 WHERE a IN (10,100) GROUP BY a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range a a 5 NULL 1 Using where; Using index for group-by
EXPLAIN SELECT a, MAX(b) FROM t2 WHERE a IN (10,100) GROUP BY a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range a a 5 NULL 2 Using where; Using index for group-by
FLUSH status;
SELECT a, MAX(b) FROM t1 WHERE a IN (10, 100) GROUP BY a;
a MAX(b)
10 10
# Should be no more than 4 reads.
SHOW status LIKE 'handler_read_key';
Variable_name Value
Handler_read_key 4
FLUSH status;
SELECT a, MAX(b) FROM t2 WHERE a IN (10, 100) GROUP BY a;
a MAX(b)
10 10
# Should be no more than 4 reads.
SHOW status LIKE 'handler_read_key';
Variable_name Value
Handler_read_key 4
DROP TABLE t1, t2;
End of 5.1 tests
End of 5.1 tests
mysql-test/t/partition_range.test
View file @
76aee430
...
@@ -931,3 +931,44 @@ insert into t2 values(52, 20070322, 456, 'filler') ;
...
@@ -931,3 +931,44 @@ insert into t2 values(52, 20070322, 456, 'filler') ;
select
sum
(
count
)
from
t2
ch
where
ch
.
defid
in
(
50
,
52
)
and
ch
.
day
between
20070320
and
20070401
group
by
defid
;
select
sum
(
count
)
from
t2
ch
where
ch
.
defid
in
(
50
,
52
)
and
ch
.
day
between
20070320
and
20070401
group
by
defid
;
drop
table
t1
,
t2
;
drop
table
t1
,
t2
;
--
echo
#
--
echo
# Bug#50939: Loose Index Scan unduly relies on engine to remember range
--
echo
# endpoints
--
echo
#
CREATE
TABLE
t1
(
a
INT
,
b
INT
,
KEY
(
a
,
b
)
)
PARTITION
BY
HASH
(
a
)
PARTITIONS
1
;
CREATE
TABLE
t2
(
a
INT
,
b
INT
,
KEY
(
a
,
b
)
);
INSERT
INTO
t1
VALUES
(
1
,
1
),
(
2
,
2
),
(
3
,
3
),
(
4
,
4
),
(
5
,
5
);
INSERT
INTO
t1
SELECT
a
+
5
,
b
+
5
FROM
t1
;
INSERT
INTO
t1
SELECT
a
+
10
,
b
+
10
FROM
t1
;
INSERT
INTO
t1
SELECT
a
+
20
,
b
+
20
FROM
t1
;
INSERT
INTO
t1
SELECT
a
+
40
,
b
+
40
FROM
t1
;
INSERT
INTO
t2
SELECT
*
FROM
t1
;
--
echo
# plans should be identical
EXPLAIN
SELECT
a
,
MAX
(
b
)
FROM
t1
WHERE
a
IN
(
10
,
100
)
GROUP
BY
a
;
EXPLAIN
SELECT
a
,
MAX
(
b
)
FROM
t2
WHERE
a
IN
(
10
,
100
)
GROUP
BY
a
;
FLUSH
status
;
SELECT
a
,
MAX
(
b
)
FROM
t1
WHERE
a
IN
(
10
,
100
)
GROUP
BY
a
;
--
echo
# Should be no more than 4 reads.
SHOW
status
LIKE
'handler_read_key'
;
FLUSH
status
;
SELECT
a
,
MAX
(
b
)
FROM
t2
WHERE
a
IN
(
10
,
100
)
GROUP
BY
a
;
--
echo
# Should be no more than 4 reads.
SHOW
status
LIKE
'handler_read_key'
;
DROP
TABLE
t1
,
t2
;
mysql-test/t/range.test
View file @
76aee430
...
@@ -1313,45 +1313,4 @@ SELECT * FROM t1 FORCE INDEX (PRIMARY)
...
@@ -1313,45 +1313,4 @@ SELECT * FROM t1 FORCE INDEX (PRIMARY)
DROP
TABLE
t1
;
DROP
TABLE
t1
;
--
echo
#
--
echo
# Bug#50939: Loose Index Scan unduly relies on engine to remember range
--
echo
# endpoints
--
echo
#
CREATE
TABLE
t1
(
a
INT
,
b
INT
,
KEY
(
a
,
b
)
)
PARTITION
BY
HASH
(
a
)
PARTITIONS
1
;
CREATE
TABLE
t2
(
a
INT
,
b
INT
,
KEY
(
a
,
b
)
);
INSERT
INTO
t1
VALUES
(
1
,
1
),
(
2
,
2
),
(
3
,
3
),
(
4
,
4
),
(
5
,
5
);
INSERT
INTO
t1
SELECT
a
+
5
,
b
+
5
FROM
t1
;
INSERT
INTO
t1
SELECT
a
+
10
,
b
+
10
FROM
t1
;
INSERT
INTO
t1
SELECT
a
+
20
,
b
+
20
FROM
t1
;
INSERT
INTO
t1
SELECT
a
+
40
,
b
+
40
FROM
t1
;
INSERT
INTO
t2
SELECT
*
FROM
t1
;
--
echo
# plans should be identical
EXPLAIN
SELECT
a
,
MAX
(
b
)
FROM
t1
WHERE
a
IN
(
10
,
100
)
GROUP
BY
a
;
EXPLAIN
SELECT
a
,
MAX
(
b
)
FROM
t2
WHERE
a
IN
(
10
,
100
)
GROUP
BY
a
;
FLUSH
status
;
SELECT
a
,
MAX
(
b
)
FROM
t1
WHERE
a
IN
(
10
,
100
)
GROUP
BY
a
;
--
echo
# Should be no more than 4 reads.
SHOW
status
LIKE
'handler_read_key'
;
FLUSH
status
;
SELECT
a
,
MAX
(
b
)
FROM
t2
WHERE
a
IN
(
10
,
100
)
GROUP
BY
a
;
--
echo
# Should be no more than 4 reads.
SHOW
status
LIKE
'handler_read_key'
;
DROP
TABLE
t1
,
t2
;
--
echo
End
of
5.1
tests
--
echo
End
of
5.1
tests
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