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
5fc801dc
Commit
5fc801dc
authored
Sep 16, 2010
by
Sergey Glukhov
Browse files
Options
Browse Files
Download
Plain Diff
5.1-bugteam->5.5-merge
parents
55ad009b
31a38c0f
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
60 additions
and
3 deletions
+60
-3
mysql-test/include/index_merge_ror_cpk.inc
mysql-test/include/index_merge_ror_cpk.inc
+16
-0
mysql-test/r/index_merge_innodb.result
mysql-test/r/index_merge_innodb.result
+18
-0
mysql-test/r/index_merge_myisam.result
mysql-test/r/index_merge_myisam.result
+18
-0
sql/opt_range.cc
sql/opt_range.cc
+8
-3
No files found.
mysql-test/include/index_merge_ror_cpk.inc
View file @
5fc801dc
...
...
@@ -126,3 +126,19 @@ WHERE
drop
table
t1
;
--
echo
#
--
echo
# Bug#50402 Optimizer producing wrong results when using Index Merge on InnoDB
--
echo
#
CREATE
TABLE
t1
(
f1
INT
,
PRIMARY
KEY
(
f1
));
INSERT
INTO
t1
VALUES
(
2
);
CREATE
TABLE
t2
(
f1
INT
,
f2
INT
,
f3
char
(
1
),
PRIMARY
KEY
(
f1
),
KEY
(
f2
),
KEY
(
f3
)
);
INSERT
INTO
t2
VALUES
(
1
,
1
,
'h'
),
(
2
,
3
,
'h'
),
(
3
,
2
,
''
),
(
4
,
2
,
''
);
SELECT
t1
.
f1
FROM
t1
WHERE
(
SELECT
COUNT
(
*
)
FROM
t2
WHERE
t2
.
f3
=
'h'
AND
t2
.
f2
=
t1
.
f1
)
=
0
AND
t1
.
f1
=
2
;
EXPLAIN
SELECT
t1
.
f1
FROM
t1
WHERE
(
SELECT
COUNT
(
*
)
FROM
t2
WHERE
t2
.
f3
=
'h'
AND
t2
.
f2
=
t1
.
f1
)
=
0
AND
t1
.
f1
=
2
;
DROP
TABLE
t1
,
t2
;
mysql-test/r/index_merge_innodb.result
View file @
5fc801dc
...
...
@@ -255,3 +255,21 @@ WHERE
`RUNID`= '' AND `SUBMITNR`= '' AND `ORDERNR`='' AND `PROGRAMM`='' AND
`TESTID`='' AND `UCCHECK`='';
drop table t1;
#
# Bug#50402 Optimizer producing wrong results when using Index Merge on InnoDB
#
CREATE TABLE t1 (f1 INT, PRIMARY KEY (f1));
INSERT INTO t1 VALUES (2);
CREATE TABLE t2 (f1 INT, f2 INT, f3 char(1),
PRIMARY KEY (f1), KEY (f2), KEY (f3) );
INSERT INTO t2 VALUES (1, 1, 'h'), (2, 3, 'h'), (3, 2, ''), (4, 2, '');
SELECT t1.f1 FROM t1
WHERE (SELECT COUNT(*) FROM t2 WHERE t2.f3 = 'h' AND t2.f2 = t1.f1) = 0 AND t1.f1 = 2;
f1
2
EXPLAIN SELECT t1.f1 FROM t1
WHERE (SELECT COUNT(*) FROM t2 WHERE t2.f3 = 'h' AND t2.f2 = t1.f1) = 0 AND t1.f1 = 2;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 const PRIMARY PRIMARY 4 const 1 Using index
2 DEPENDENT SUBQUERY t2 index_merge f2,f3 f3,f2 2,5 NULL 1 Using intersect(f3,f2); Using where; Using index
DROP TABLE t1,t2;
mysql-test/r/index_merge_myisam.result
View file @
5fc801dc
...
...
@@ -1414,6 +1414,24 @@ WHERE
`TESTID`='' AND `UCCHECK`='';
drop table t1;
#
# Bug#50402 Optimizer producing wrong results when using Index Merge on InnoDB
#
CREATE TABLE t1 (f1 INT, PRIMARY KEY (f1));
INSERT INTO t1 VALUES (2);
CREATE TABLE t2 (f1 INT, f2 INT, f3 char(1),
PRIMARY KEY (f1), KEY (f2), KEY (f3) );
INSERT INTO t2 VALUES (1, 1, 'h'), (2, 3, 'h'), (3, 2, ''), (4, 2, '');
SELECT t1.f1 FROM t1
WHERE (SELECT COUNT(*) FROM t2 WHERE t2.f3 = 'h' AND t2.f2 = t1.f1) = 0 AND t1.f1 = 2;
f1
2
EXPLAIN SELECT t1.f1 FROM t1
WHERE (SELECT COUNT(*) FROM t2 WHERE t2.f3 = 'h' AND t2.f2 = t1.f1) = 0 AND t1.f1 = 2;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 system PRIMARY NULL NULL NULL 1
2 DEPENDENT SUBQUERY t2 ref f2,f3 f2 5 1 Using where
DROP TABLE t1,t2;
#
# Generic @@optimizer_switch tests (move those into a separate file if
# we get another @@optimizer_switch user)
#
...
...
sql/opt_range.cc
View file @
5fc801dc
...
...
@@ -8550,8 +8550,13 @@ int QUICK_RANGE_SELECT::reset()
in_range
=
FALSE
;
cur_range
=
(
QUICK_RANGE
**
)
ranges
.
buffer
;
if
(
file
->
inited
==
handler
::
NONE
&&
(
error
=
file
->
ha_index_init
(
index
,
1
)))
if
(
file
->
inited
==
handler
::
NONE
)
{
if
(
in_ror_merged_scan
)
head
->
column_bitmaps_set_no_signal
(
&
column_bitmap
,
&
column_bitmap
);
if
((
error
=
file
->
ha_index_init
(
index
,
1
)))
DBUG_RETURN
(
error
);
}
/* Do not allocate the buffers twice. */
if
(
multi_range_length
)
...
...
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