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
df8b7799
Commit
df8b7799
authored
Aug 08, 2003
by
serg@serg.mylan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
between range optimization bug (between with const on one end only)
parent
f96d57d3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
6 deletions
+9
-6
mysql-test/r/range.result
mysql-test/r/range.result
+1
-1
sql/opt_range.cc
sql/opt_range.cc
+8
-5
No files found.
mysql-test/r/range.result
View file @
df8b7799
...
@@ -232,7 +232,7 @@ update t1 set y=x;
...
@@ -232,7 +232,7 @@ update t1 set y=x;
explain select * from t1, t1 t2 where t1.y = 2 and t2.x between 7 and t1.y+0;
explain select * from t1, t1 t2 where t1.y = 2 and t2.x between 7 and t1.y+0;
table type possible_keys key key_len ref rows Extra
table type possible_keys key key_len ref rows Extra
t1 ref y y 5 const 1 Using where
t1 ref y y 5 const 1 Using where
t2
ALL x NULL NULL NULL 9
Using where
t2
range x x 5 NULL 4
Using where
explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= 7 and t2.x <= t1.y+0;
explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= 7 and t2.x <= t1.y+0;
table type possible_keys key key_len ref rows Extra
table type possible_keys key key_len ref rows Extra
t1 ref y y 5 const 1 Using where
t1 ref y y 5 const 1 Using where
...
...
sql/opt_range.cc
View file @
df8b7799
...
@@ -794,18 +794,15 @@ static SEL_TREE *get_mm_tree(PARAM *param,COND *cond)
...
@@ -794,18 +794,15 @@ static SEL_TREE *get_mm_tree(PARAM *param,COND *cond)
DBUG_RETURN
(
new
SEL_TREE
(
SEL_TREE
::
ALWAYS
));
DBUG_RETURN
(
new
SEL_TREE
(
SEL_TREE
::
ALWAYS
));
DBUG_RETURN
(
new
SEL_TREE
(
SEL_TREE
::
IMPOSSIBLE
));
DBUG_RETURN
(
new
SEL_TREE
(
SEL_TREE
::
IMPOSSIBLE
));
}
}
table_map
ref_tables
=
cond
->
used_tables
();
table_map
ref_tables
=
cond
->
used_tables
();
if
(
ref_tables
&
~
(
param
->
prev_tables
|
param
->
read_tables
|
param
->
current_table
))
DBUG_RETURN
(
0
);
// Can't be calculated yet
if
(
cond
->
type
()
!=
Item
::
FUNC_ITEM
)
if
(
cond
->
type
()
!=
Item
::
FUNC_ITEM
)
{
// Should be a field
{
// Should be a field
if
(
ref_tables
&
param
->
current_table
)
if
(
ref_tables
&
param
->
current_table
)
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
DBUG_RETURN
(
new
SEL_TREE
(
SEL_TREE
::
MAYBE
));
DBUG_RETURN
(
new
SEL_TREE
(
SEL_TREE
::
MAYBE
));
}
}
if
(
!
(
ref_tables
&
param
->
current_table
))
DBUG_RETURN
(
new
SEL_TREE
(
SEL_TREE
::
MAYBE
));
// This may be false or true
Item_func
*
cond_func
=
(
Item_func
*
)
cond
;
Item_func
*
cond_func
=
(
Item_func
*
)
cond
;
if
(
cond_func
->
select_optimize
()
==
Item_func
::
OPTIMIZE_NONE
)
if
(
cond_func
->
select_optimize
()
==
Item_func
::
OPTIMIZE_NONE
)
DBUG_RETURN
(
0
);
// Can't be calculated
DBUG_RETURN
(
0
);
// Can't be calculated
...
@@ -847,6 +844,12 @@ static SEL_TREE *get_mm_tree(PARAM *param,COND *cond)
...
@@ -847,6 +844,12 @@ static SEL_TREE *get_mm_tree(PARAM *param,COND *cond)
DBUG_RETURN
(
0
);
// Can't optimize this IN
DBUG_RETURN
(
0
);
// Can't optimize this IN
}
}
if
(
ref_tables
&
~
(
param
->
prev_tables
|
param
->
read_tables
|
param
->
current_table
))
DBUG_RETURN
(
0
);
// Can't be calculated yet
if
(
!
(
ref_tables
&
param
->
current_table
))
DBUG_RETURN
(
new
SEL_TREE
(
SEL_TREE
::
MAYBE
));
// This may be false or true
/* check field op const */
/* check field op const */
/* btw, ft_func's arguments()[0] isn't FIELD_ITEM. SerG*/
/* btw, ft_func's arguments()[0] isn't FIELD_ITEM. SerG*/
if
(
cond_func
->
arguments
()[
0
]
->
type
()
==
Item
::
FIELD_ITEM
)
if
(
cond_func
->
arguments
()[
0
]
->
type
()
==
Item
::
FIELD_ITEM
)
...
...
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