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
349e31d5
Commit
349e31d5
authored
Jun 07, 2014
by
Sergey Petrunya
Browse files
Options
Browse Files
Download
Plain Diff
Merge
parents
ee6f400f
71df0355
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
57 additions
and
0 deletions
+57
-0
mysql-test/r/selectivity_no_engine.result
mysql-test/r/selectivity_no_engine.result
+28
-0
mysql-test/t/selectivity_no_engine.test
mysql-test/t/selectivity_no_engine.test
+28
-0
sql/sql_select.cc
sql/sql_select.cc
+1
-0
No files found.
mysql-test/r/selectivity_no_engine.result
View file @
349e31d5
...
...
@@ -215,6 +215,34 @@ SELECT * FROM t1 AS t1_1, t1 AS t1_2 WHERE NOT ( t1_1.a <> 'baz');
a b a b
DROP TABLE t1;
#
# MDEV-6308: Server crashes in table_multi_eq_cond_selectivity with ...
#
CREATE TABLE t1 (
id varchar(40) COLLATE utf8_bin,
dt datetime,
PRIMARY KEY (id)
);
INSERT INTO t1 VALUES ('foo','2011-04-12 05:18:08'),
('bar','2013-09-19 11:37:03');
CREATE TABLE t2 (
t1_id varchar(40) COLLATE utf8_bin,
f1 varchar(64),
f2 varchar(1024),
KEY (f1,f2(255))
);
INSERT INTO t2 VALUES ('foo','baz','qux'),('bar','baz','qux');
set optimizer_use_condition_selectivity=2;
explain
select * from t1,t2 where t1.id = t2.t1_id and t2.f2='qux' and t2.f1='baz';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref f1 f1 325 const,const 1 Using index condition; Using where
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 122 test.t2.t1_id 1
select * from t1,t2 where t1.id = t2.t1_id and t2.f2='qux' and t2.f1='baz';
id dt t1_id f1 f2
foo 2011-04-12 05:18:08 foo baz qux
bar 2013-09-19 11:37:03 bar baz qux
drop table t1,t2;
#
# End of the test file
#
set use_stat_tables= @save_use_stat_tables;
...
...
mysql-test/t/selectivity_no_engine.test
View file @
349e31d5
...
...
@@ -161,6 +161,34 @@ INSERT INTO t1 VALUES ('foo',1),('bar',2);
SELECT
*
FROM
t1
AS
t1_1
,
t1
AS
t1_2
WHERE
NOT
(
t1_1
.
a
<>
'baz'
);
DROP
TABLE
t1
;
--
echo
#
--
echo
# MDEV-6308: Server crashes in table_multi_eq_cond_selectivity with ...
--
echo
#
CREATE
TABLE
t1
(
id
varchar
(
40
)
COLLATE
utf8_bin
,
dt
datetime
,
PRIMARY
KEY
(
id
)
);
INSERT
INTO
t1
VALUES
(
'foo'
,
'2011-04-12 05:18:08'
),
(
'bar'
,
'2013-09-19 11:37:03'
);
CREATE
TABLE
t2
(
t1_id
varchar
(
40
)
COLLATE
utf8_bin
,
f1
varchar
(
64
),
f2
varchar
(
1024
),
KEY
(
f1
,
f2
(
255
))
);
INSERT
INTO
t2
VALUES
(
'foo'
,
'baz'
,
'qux'
),(
'bar'
,
'baz'
,
'qux'
);
set
optimizer_use_condition_selectivity
=
2
;
explain
select
*
from
t1
,
t2
where
t1
.
id
=
t2
.
t1_id
and
t2
.
f2
=
'qux'
and
t2
.
f1
=
'baz'
;
select
*
from
t1
,
t2
where
t1
.
id
=
t2
.
t1_id
and
t2
.
f2
=
'qux'
and
t2
.
f1
=
'baz'
;
drop
table
t1
,
t2
;
--
echo
#
--
echo
# End of the test file
--
echo
#
...
...
sql/sql_select.cc
View file @
349e31d5
...
...
@@ -7367,6 +7367,7 @@ double table_cond_selectivity(JOIN *join, uint idx, JOIN_TAB *s,
Go through the "keypart{N}=..." equalities and find those that were
already taken into account in table->cond_selectivity.
*/
keyuse
=
pos
->
key
;
while
(
keyuse
->
table
==
table
&&
keyuse
->
key
==
key
)
{
if
(
!
(
keyuse
->
used_tables
&
(
rem_tables
|
table
->
map
)))
...
...
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