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
91365089
Commit
91365089
authored
Aug 25, 2009
by
Sergey Petrunya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MWL#17: Table elimination
- More test coverage - Remove unused code
parent
5dcd894b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
12 deletions
+14
-12
mysql-test/r/table_elim.result
mysql-test/r/table_elim.result
+9
-2
mysql-test/t/table_elim.test
mysql-test/t/table_elim.test
+2
-0
sql/opt_table_elimination.cc
sql/opt_table_elimination.cc
+3
-10
No files found.
mysql-test/r/table_elim.result
View file @
91365089
...
...
@@ -314,8 +314,8 @@ create table t1 (a int, b int, c int, d int);
insert into t1 values (0,0,0,0),(1,1,1,1),(2,2,2,2),(3,3,3,3);
create table t2 (pk int primary key, b int)
as select a as pk, a as b from t1 where a in (1,2);
create table t3 (pk
int primary key, b int)
as select a as pk
, a as b from t1 where a in (1,3);
create table t3 (pk
1 int, pk2 int, b int, unique(pk1,pk2));
insert into t3 select a as pk1, a as pk2
, a as b from t1 where a in (1,3);
explain select t1.a from t1 left join t2 on t2.pk=t1.a and t2.b<t1.b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 4
...
...
@@ -344,4 +344,11 @@ id select_type table type possible_keys key key_len ref rows Extra
explain select t1.a from t1 left join t2 on t2.pk in (t1.a);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 4
explain select t1.a from t1 left join t2 on TRUE;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 4
1 SIMPLE t2 index NULL PRIMARY 4 NULL 2 Using index
explain select t1.a from t1 left join t3 on t3.pk1=t1.a and t3.pk2 IS NULL;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 4
drop table t1,t2,t3;
mysql-test/t/table_elim.test
View file @
91365089
...
...
@@ -274,5 +274,7 @@ explain select t1.a from t1 left join t2 on t2.pk in (t1.a);
explain
select
t1
.
a
from
t1
left
join
t2
on
TRUE
;
explain
select
t1
.
a
from
t1
left
join
t3
on
t3
.
pk1
=
t1
.
a
and
t3
.
pk2
IS
NULL
;
drop
table
t1
,
t2
,
t3
;
sql/opt_table_elimination.cc
View file @
91365089
...
...
@@ -490,7 +490,7 @@ void build_eq_mods_for_cond(Func_dep_analyzer *fda, Equality_module **eq_mod,
{
Item
*
tmp
=
new
Item_null
;
if
(
tmp
)
add_eq_mod
(
fda
,
eq_mod
,
*
and_level
,
cond_func
,
args
[
0
],
args
[
1
]
);
add_eq_mod
(
fda
,
eq_mod
,
*
and_level
,
cond_func
,
args
[
0
],
tmp
);
break
;
}
case
Item_func
:
:
MULT_EQUAL_FUNC
:
...
...
@@ -828,7 +828,7 @@ static Table_value *get_table_value(Func_dep_analyzer *fda, TABLE *table)
{
Table_value
*
tbl_dep
;
if
(
!
(
tbl_dep
=
new
Table_value
(
table
)))
return
NULL
;
/* purecov: inspected */
return
NULL
;
Key_module
**
key_list
=
&
(
tbl_dep
->
keys
);
/* Add dependencies for unique keys */
...
...
@@ -853,15 +853,8 @@ static Table_value *get_table_value(Func_dep_analyzer *fda, TABLE *table)
static
Field_value
*
get_field_value
(
Func_dep_analyzer
*
fda
,
Field
*
field
)
{
TABLE
*
table
=
field
->
table
;
Table_value
*
tbl_dep
;
Table_value
*
tbl_dep
=
fda
->
table_deps
[
table
->
tablenr
]
;
/* First, get the table*/
if
(
!
(
tbl_dep
=
fda
->
table_deps
[
table
->
tablenr
]))
{
if
(
!
(
tbl_dep
=
get_table_value
(
fda
,
table
)))
return
NULL
;
}
/* Try finding the field in field list */
Field_value
**
pfield
=
&
(
tbl_dep
->
fields
);
while
(
*
pfield
&&
(
*
pfield
)
->
field
->
field_index
<
field
->
field_index
)
...
...
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