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
26f0cd8a
Commit
26f0cd8a
authored
Apr 14, 2020
by
Marko Mäkelä
Browse files
Options
Browse Files
Download
Plain Diff
Merge 5.5 into 10.1
parents
0b7a79c6
c1394ab6
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
67 additions
and
7 deletions
+67
-7
mysql-test/r/range.result
mysql-test/r/range.result
+20
-0
mysql-test/r/range_mrr_icp.result
mysql-test/r/range_mrr_icp.result
+20
-0
mysql-test/t/range.test
mysql-test/t/range.test
+16
-0
sql/opt_range.cc
sql/opt_range.cc
+10
-6
support-files/rpm/my.cnf
support-files/rpm/my.cnf
+1
-1
No files found.
mysql-test/r/range.result
View file @
26f0cd8a
...
@@ -2145,6 +2145,26 @@ value1 1003560 12345
...
@@ -2145,6 +2145,26 @@ value1 1003560 12345
value1 1004807 12345
value1 1004807 12345
drop table t1;
drop table t1;
#
#
# MDEV-22191: Range access is not picked when index_merge_sort_union is turned off
#
set @save_optimizer_switch=@@optimizer_switch;
set @save_optimizer_switch="index_merge_sort_union=OFF";
CREATE TABLE t1 (a INT, INDEX(a));
INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
explain
SELECT * FROM t1 WHERE a > 5;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range a a 5 NULL 5 Using where; Using index
SELECT * FROM t1 WHERE a > 5;
a
6
7
8
9
set @@optimizer_switch=@save_optimizer_switch;
drop table t1;
# End of 5.5 tests
#
# BUG#13731380: RANGE OPTIMIZER CALLS RECORDS_IN_RANGE() FOR OPEN RANGE
# BUG#13731380: RANGE OPTIMIZER CALLS RECORDS_IN_RANGE() FOR OPEN RANGE
#
#
CREATE TABLE t1 (pk INT PRIMARY KEY);
CREATE TABLE t1 (pk INT PRIMARY KEY);
...
...
mysql-test/r/range_mrr_icp.result
View file @
26f0cd8a
...
@@ -2147,6 +2147,26 @@ value1 1003560 12345
...
@@ -2147,6 +2147,26 @@ value1 1003560 12345
value1 1004807 12345
value1 1004807 12345
drop table t1;
drop table t1;
#
#
# MDEV-22191: Range access is not picked when index_merge_sort_union is turned off
#
set @save_optimizer_switch=@@optimizer_switch;
set @save_optimizer_switch="index_merge_sort_union=OFF";
CREATE TABLE t1 (a INT, INDEX(a));
INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
explain
SELECT * FROM t1 WHERE a > 5;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range a a 5 NULL 5 Using where; Using index
SELECT * FROM t1 WHERE a > 5;
a
6
7
8
9
set @@optimizer_switch=@save_optimizer_switch;
drop table t1;
# End of 5.5 tests
#
# BUG#13731380: RANGE OPTIMIZER CALLS RECORDS_IN_RANGE() FOR OPEN RANGE
# BUG#13731380: RANGE OPTIMIZER CALLS RECORDS_IN_RANGE() FOR OPEN RANGE
#
#
CREATE TABLE t1 (pk INT PRIMARY KEY);
CREATE TABLE t1 (pk INT PRIMARY KEY);
...
...
mysql-test/t/range.test
View file @
26f0cd8a
...
@@ -1719,6 +1719,22 @@ where (key1varchar='value1' AND (key2int <=1 OR key2int > 1));
...
@@ -1719,6 +1719,22 @@ where (key1varchar='value1' AND (key2int <=1 OR key2int > 1));
select
*
from
t1
;
select
*
from
t1
;
drop
table
t1
;
drop
table
t1
;
--
echo
#
--
echo
# MDEV-22191: Range access is not picked when index_merge_sort_union is turned off
--
echo
#
set
@
save_optimizer_switch
=@@
optimizer_switch
;
set
@
save_optimizer_switch
=
"index_merge_sort_union=OFF"
;
CREATE
TABLE
t1
(
a
INT
,
INDEX
(
a
));
INSERT
INTO
t1
VALUES
(
0
),(
1
),(
2
),(
3
),(
4
),(
5
),(
6
),(
7
),(
8
),(
9
);
explain
SELECT
*
FROM
t1
WHERE
a
>
5
;
SELECT
*
FROM
t1
WHERE
a
>
5
;
set
@@
optimizer_switch
=@
save_optimizer_switch
;
drop
table
t1
;
--
echo
# End of 5.5 tests
--
echo
#
--
echo
#
--
echo
# BUG#13731380: RANGE OPTIMIZER CALLS RECORDS_IN_RANGE() FOR OPEN RANGE
--
echo
# BUG#13731380: RANGE OPTIMIZER CALLS RECORDS_IN_RANGE() FOR OPEN RANGE
--
echo
#
--
echo
#
...
...
sql/opt_range.cc
View file @
26f0cd8a
...
@@ -359,7 +359,8 @@ QUICK_RANGE_SELECT *get_quick_select(PARAM *param,uint index,
...
@@ -359,7 +359,8 @@ QUICK_RANGE_SELECT *get_quick_select(PARAM *param,uint index,
static
TRP_RANGE
*
get_key_scans_params
(
PARAM
*
param
,
SEL_TREE
*
tree
,
static
TRP_RANGE
*
get_key_scans_params
(
PARAM
*
param
,
SEL_TREE
*
tree
,
bool
index_read_must_be_used
,
bool
index_read_must_be_used
,
bool
update_tbl_stats
,
bool
update_tbl_stats
,
double
read_time
);
double
read_time
,
bool
ror_scans_required
);
static
static
TRP_INDEX_INTERSECT
*
get_best_index_intersect
(
PARAM
*
param
,
SEL_TREE
*
tree
,
TRP_INDEX_INTERSECT
*
get_best_index_intersect
(
PARAM
*
param
,
SEL_TREE
*
tree
,
double
read_time
);
double
read_time
);
...
@@ -2598,7 +2599,7 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use,
...
@@ -2598,7 +2599,7 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use,
/* Get best 'range' plan and prepare data for making other plans */
/* Get best 'range' plan and prepare data for making other plans */
if
((
range_trp
=
get_key_scans_params
(
&
param
,
tree
,
FALSE
,
TRUE
,
if
((
range_trp
=
get_key_scans_params
(
&
param
,
tree
,
FALSE
,
TRUE
,
best_read_time
)))
best_read_time
,
FALSE
)))
{
{
best_trp
=
range_trp
;
best_trp
=
range_trp
;
best_read_time
=
best_trp
->
read_cost
;
best_read_time
=
best_trp
->
read_cost
;
...
@@ -4721,7 +4722,8 @@ TABLE_READ_PLAN *get_best_disjunct_quick(PARAM *param, SEL_IMERGE *imerge,
...
@@ -4721,7 +4722,8 @@ TABLE_READ_PLAN *get_best_disjunct_quick(PARAM *param, SEL_IMERGE *imerge,
{
{
DBUG_EXECUTE
(
"info"
,
print_sel_tree
(
param
,
*
ptree
,
&
(
*
ptree
)
->
keys_map
,
DBUG_EXECUTE
(
"info"
,
print_sel_tree
(
param
,
*
ptree
,
&
(
*
ptree
)
->
keys_map
,
"tree in SEL_IMERGE"
););
"tree in SEL_IMERGE"
););
if
(
!
(
*
cur_child
=
get_key_scans_params
(
param
,
*
ptree
,
TRUE
,
FALSE
,
read_time
)))
if
(
!
(
*
cur_child
=
get_key_scans_params
(
param
,
*
ptree
,
TRUE
,
FALSE
,
read_time
,
TRUE
)))
{
{
/*
/*
One of index scans in this index_merge is more expensive than entire
One of index scans in this index_merge is more expensive than entire
...
@@ -5043,7 +5045,7 @@ TABLE_READ_PLAN *merge_same_index_scans(PARAM *param, SEL_IMERGE *imerge,
...
@@ -5043,7 +5045,7 @@ TABLE_READ_PLAN *merge_same_index_scans(PARAM *param, SEL_IMERGE *imerge,
index merge retrievals are not well calibrated
index merge retrievals are not well calibrated
*/
*/
trp
=
get_key_scans_params
(
param
,
*
imerge
->
trees
,
FALSE
,
TRUE
,
trp
=
get_key_scans_params
(
param
,
*
imerge
->
trees
,
FALSE
,
TRUE
,
read_time
);
read_time
,
TRUE
);
}
}
DBUG_RETURN
(
trp
);
DBUG_RETURN
(
trp
);
...
@@ -6771,6 +6773,7 @@ TRP_ROR_INTERSECT *get_best_covering_ror_intersect(PARAM *param,
...
@@ -6771,6 +6773,7 @@ TRP_ROR_INTERSECT *get_best_covering_ror_intersect(PARAM *param,
index_read_must_be_used if TRUE, assume 'index only' option will be set
index_read_must_be_used if TRUE, assume 'index only' option will be set
(except for clustered PK indexes)
(except for clustered PK indexes)
read_time don't create read plans with cost > read_time.
read_time don't create read plans with cost > read_time.
ror_scans_required set to TRUE for index merge
RETURN
RETURN
Best range read plan
Best range read plan
NULL if no plan found or error occurred
NULL if no plan found or error occurred
...
@@ -6779,7 +6782,8 @@ TRP_ROR_INTERSECT *get_best_covering_ror_intersect(PARAM *param,
...
@@ -6779,7 +6782,8 @@ TRP_ROR_INTERSECT *get_best_covering_ror_intersect(PARAM *param,
static
TRP_RANGE
*
get_key_scans_params
(
PARAM
*
param
,
SEL_TREE
*
tree
,
static
TRP_RANGE
*
get_key_scans_params
(
PARAM
*
param
,
SEL_TREE
*
tree
,
bool
index_read_must_be_used
,
bool
index_read_must_be_used
,
bool
update_tbl_stats
,
bool
update_tbl_stats
,
double
read_time
)
double
read_time
,
bool
ror_scans_required
)
{
{
uint
idx
,
best_idx
;
uint
idx
,
best_idx
;
SEL_ARG
*
key_to_read
=
NULL
;
SEL_ARG
*
key_to_read
=
NULL
;
...
@@ -6827,7 +6831,7 @@ static TRP_RANGE *get_key_scans_params(PARAM *param, SEL_TREE *tree,
...
@@ -6827,7 +6831,7 @@ static TRP_RANGE *get_key_scans_params(PARAM *param, SEL_TREE *tree,
update_tbl_stats
,
&
mrr_flags
,
update_tbl_stats
,
&
mrr_flags
,
&
buf_size
,
&
cost
);
&
buf_size
,
&
cost
);
if
(
!
param
->
is_ror_scan
&&
if
(
ror_scans_required
&&
!
param
->
is_ror_scan
&&
!
optimizer_flag
(
param
->
thd
,
OPTIMIZER_SWITCH_INDEX_MERGE_SORT_UNION
))
!
optimizer_flag
(
param
->
thd
,
OPTIMIZER_SWITCH_INDEX_MERGE_SORT_UNION
))
{
{
/* The scan is not a ROR-scan, just skip it */
/* The scan is not a ROR-scan, just skip it */
...
...
support-files/rpm/my.cnf
View file @
26f0cd8a
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
[client-server]
[client-server]
#
#
# include
all files
from the config directory
# include
*.cnf
from the config directory
#
#
!includedir /etc/my.cnf.d
!includedir /etc/my.cnf.d
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