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
8757c0c5
Commit
8757c0c5
authored
Sep 20, 2010
by
Igor Babaev
Browse files
Options
Browse Files
Download
Plain Diff
Merge
parents
9132fab7
3c313312
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
110 additions
and
1 deletion
+110
-1
mysql-test/r/index_merge_innodb.result
mysql-test/r/index_merge_innodb.result
+55
-0
mysql-test/t/index_merge_innodb.test
mysql-test/t/index_merge_innodb.test
+53
-0
sql/records.cc
sql/records.cc
+2
-1
No files found.
mysql-test/r/index_merge_innodb.result
View file @
8757c0c5
...
@@ -581,3 +581,58 @@ WHERE
...
@@ -581,3 +581,58 @@ WHERE
`RUNID`= '' AND `SUBMITNR`= '' AND `ORDERNR`='' AND `PROGRAMM`='' AND
`RUNID`= '' AND `SUBMITNR`= '' AND `ORDERNR`='' AND `PROGRAMM`='' AND
`TESTID`='' AND `UCCHECK`='';
`TESTID`='' AND `UCCHECK`='';
drop table t1;
drop table t1;
#
# BUG#56862/640419: Wrong result with sort_union index merge when one
# of the merged index scans is the primary key scan
#
CREATE TABLE t1 (
pk int NOT NULL AUTO_INCREMENT PRIMARY KEY,
a int,
b int,
INDEX idx(a))
ENGINE=INNODB;
INSERT INTO t1(a,b) VALUES
(11, 1100), (2, 200), (1, 100), (14, 1400), (5, 500),
(3, 300), (17, 1700), (4, 400), (12, 1200), (8, 800),
(6, 600), (18, 1800), (9, 900), (10, 1000), (7, 700),
(13, 1300), (15, 1500), (19, 1900), (16, 1600), (20, 2000);
INSERT INTO t1(a,b) SELECT a+20, b+2000 FROM t1;
INSERT INTO t1(a,b) SELECT a+40, b+4000 FROM t1;
INSERT INTO t1(a,b) SELECT a+80, b+8000 FROM t1;
INSERT INTO t1(a,b) SELECT a,b FROM t1;
INSERT INTO t1(a,b) SELECT a,b FROM t1;
INSERT INTO t1(a,b) SELECT a,b FROM t1;
INSERT INTO t1(a,b) SELECT a,b FROM t1;
INSERT INTO t1(a,b) SELECT a,b FROM t1;
INSERT INTO t1(a,b) SELECT a,b FROM t1;
INSERT INTO t1(a,b) SELECT a,b FROM t1;
INSERT INTO t1(a,b) SELECT a,b FROM t1;
INSERT INTO t1(a,b) SELECT a,b FROM t1;
INSERT INTO t1(a,b) SELECT a,b FROM t1;
INSERT INTO t1 VALUES (1000000, 0, 0);
SET SESSION sort_buffer_size = 1024*36;
EXPLAIN
SELECT COUNT(*) FROM
(SELECT * FROM t1
WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
2 DERIVED t1 index_merge PRIMARY,idx idx,PRIMARY 5,4 NULL 11419 Using sort_union(idx,PRIMARY); Using where
SELECT COUNT(*) FROM
(SELECT * FROM t1
WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t;
COUNT(*)
6145
EXPLAIN
SELECT COUNT(*) FROM
(SELECT * FROM t1 IGNORE INDEX(idx)
WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL # Select tables optimized away
2 DERIVED t1 ALL PRIMARY NULL NULL NULL # Using where
SELECT COUNT(*) FROM
(SELECT * FROM t1 IGNORE INDEX(idx)
WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t;
COUNT(*)
6145
DROP TABLE t1;
mysql-test/t/index_merge_innodb.test
View file @
8757c0c5
...
@@ -29,3 +29,56 @@ let $merge_table_support= 0;
...
@@ -29,3 +29,56 @@ let $merge_table_support= 0;
--
source
include
/
index_merge2
.
inc
--
source
include
/
index_merge2
.
inc
--
source
include
/
index_merge_2sweeps
.
inc
--
source
include
/
index_merge_2sweeps
.
inc
--
source
include
/
index_merge_ror_cpk
.
inc
--
source
include
/
index_merge_ror_cpk
.
inc
--
echo
#
--
echo
# BUG#56862/640419: Wrong result with sort_union index merge when one
--
echo
# of the merged index scans is the primary key scan
--
echo
#
CREATE
TABLE
t1
(
pk
int
NOT
NULL
AUTO_INCREMENT
PRIMARY
KEY
,
a
int
,
b
int
,
INDEX
idx
(
a
))
ENGINE
=
INNODB
;
INSERT
INTO
t1
(
a
,
b
)
VALUES
(
11
,
1100
),
(
2
,
200
),
(
1
,
100
),
(
14
,
1400
),
(
5
,
500
),
(
3
,
300
),
(
17
,
1700
),
(
4
,
400
),
(
12
,
1200
),
(
8
,
800
),
(
6
,
600
),
(
18
,
1800
),
(
9
,
900
),
(
10
,
1000
),
(
7
,
700
),
(
13
,
1300
),
(
15
,
1500
),
(
19
,
1900
),
(
16
,
1600
),
(
20
,
2000
);
INSERT
INTO
t1
(
a
,
b
)
SELECT
a
+
20
,
b
+
2000
FROM
t1
;
INSERT
INTO
t1
(
a
,
b
)
SELECT
a
+
40
,
b
+
4000
FROM
t1
;
INSERT
INTO
t1
(
a
,
b
)
SELECT
a
+
80
,
b
+
8000
FROM
t1
;
INSERT
INTO
t1
(
a
,
b
)
SELECT
a
,
b
FROM
t1
;
INSERT
INTO
t1
(
a
,
b
)
SELECT
a
,
b
FROM
t1
;
INSERT
INTO
t1
(
a
,
b
)
SELECT
a
,
b
FROM
t1
;
INSERT
INTO
t1
(
a
,
b
)
SELECT
a
,
b
FROM
t1
;
INSERT
INTO
t1
(
a
,
b
)
SELECT
a
,
b
FROM
t1
;
INSERT
INTO
t1
(
a
,
b
)
SELECT
a
,
b
FROM
t1
;
INSERT
INTO
t1
(
a
,
b
)
SELECT
a
,
b
FROM
t1
;
INSERT
INTO
t1
(
a
,
b
)
SELECT
a
,
b
FROM
t1
;
INSERT
INTO
t1
(
a
,
b
)
SELECT
a
,
b
FROM
t1
;
INSERT
INTO
t1
(
a
,
b
)
SELECT
a
,
b
FROM
t1
;
INSERT
INTO
t1
VALUES
(
1000000
,
0
,
0
);
SET
SESSION
sort_buffer_size
=
1024
*
36
;
EXPLAIN
SELECT
COUNT
(
*
)
FROM
(
SELECT
*
FROM
t1
WHERE
a
BETWEEN
2
AND
7
OR
pk
=
1000000
)
AS
t
;
SELECT
COUNT
(
*
)
FROM
(
SELECT
*
FROM
t1
WHERE
a
BETWEEN
2
AND
7
OR
pk
=
1000000
)
AS
t
;
--
replace_column
9
#
EXPLAIN
SELECT
COUNT
(
*
)
FROM
(
SELECT
*
FROM
t1
IGNORE
INDEX
(
idx
)
WHERE
a
BETWEEN
2
AND
7
OR
pk
=
1000000
)
AS
t
;
SELECT
COUNT
(
*
)
FROM
(
SELECT
*
FROM
t1
IGNORE
INDEX
(
idx
)
WHERE
a
BETWEEN
2
AND
7
OR
pk
=
1000000
)
AS
t
;
DROP
TABLE
t1
;
sql/records.cc
View file @
8757c0c5
...
@@ -196,7 +196,8 @@ void init_read_record(READ_RECORD *info,THD *thd, TABLE *table,
...
@@ -196,7 +196,8 @@ void init_read_record(READ_RECORD *info,THD *thd, TABLE *table,
tempfile
=
&
select
->
file
;
tempfile
=
&
select
->
file
;
else
else
tempfile
=
table
->
sort
.
io_cache
;
tempfile
=
table
->
sort
.
io_cache
;
if
(
tempfile
&&
my_b_inited
(
tempfile
))
// Test if ref-records was used
if
(
tempfile
&&
my_b_inited
(
tempfile
)
&&
!
(
select
&&
select
->
quick
))
{
{
DBUG_PRINT
(
"info"
,(
"using rr_from_tempfile"
));
DBUG_PRINT
(
"info"
,(
"using rr_from_tempfile"
));
info
->
read_record
=
(
table
->
sort
.
addon_field
?
info
->
read_record
=
(
table
->
sort
.
addon_field
?
...
...
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