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
b7cfd197
Commit
b7cfd197
authored
Apr 16, 2020
by
Varun Gupta
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor fixup to MDEV-22191
parent
c1394ab6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
6 deletions
+11
-6
sql/opt_range.cc
sql/opt_range.cc
+11
-6
No files found.
sql/opt_range.cc
View file @
b7cfd197
...
@@ -4673,6 +4673,7 @@ TABLE_READ_PLAN *get_best_disjunct_quick(PARAM *param, SEL_IMERGE *imerge,
...
@@ -4673,6 +4673,7 @@ TABLE_READ_PLAN *get_best_disjunct_quick(PARAM *param, SEL_IMERGE *imerge,
double
roru_index_costs
;
double
roru_index_costs
;
ha_rows
roru_total_records
;
ha_rows
roru_total_records
;
double
roru_intersect_part
=
1.0
;
double
roru_intersect_part
=
1.0
;
bool
only_ror_scans_required
=
FALSE
;
DBUG_ENTER
(
"get_best_disjunct_quick"
);
DBUG_ENTER
(
"get_best_disjunct_quick"
);
DBUG_PRINT
(
"info"
,
(
"Full table scan cost: %g"
,
read_time
));
DBUG_PRINT
(
"info"
,
(
"Full table scan cost: %g"
,
read_time
));
...
@@ -4698,6 +4699,9 @@ TABLE_READ_PLAN *get_best_disjunct_quick(PARAM *param, SEL_IMERGE *imerge,
...
@@ -4698,6 +4699,9 @@ TABLE_READ_PLAN *get_best_disjunct_quick(PARAM *param, SEL_IMERGE *imerge,
sizeof
(
TRP_RANGE
*
)
*
sizeof
(
TRP_RANGE
*
)
*
n_child_scans
)))
n_child_scans
)))
DBUG_RETURN
(
NULL
);
DBUG_RETURN
(
NULL
);
only_ror_scans_required
=
!
optimizer_flag
(
param
->
thd
,
OPTIMIZER_SWITCH_INDEX_MERGE_SORT_UNION
);
/*
/*
Collect best 'range' scan for each of disjuncts, and, while doing so,
Collect best 'range' scan for each of disjuncts, and, while doing so,
analyze possibility of ROR scans. Also calculate some values needed by
analyze possibility of ROR scans. Also calculate some values needed by
...
@@ -4710,7 +4714,8 @@ TABLE_READ_PLAN *get_best_disjunct_quick(PARAM *param, SEL_IMERGE *imerge,
...
@@ -4710,7 +4714,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
,
if
(
!
(
*
cur_child
=
get_key_scans_params
(
param
,
*
ptree
,
TRUE
,
FALSE
,
read_time
,
TRUE
)))
read_time
,
only_ror_scans_required
)))
{
{
/*
/*
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
...
@@ -5032,7 +5037,7 @@ TABLE_READ_PLAN *merge_same_index_scans(PARAM *param, SEL_IMERGE *imerge,
...
@@ -5032,7 +5037,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
,
TRU
E
);
read_time
,
FALS
E
);
}
}
DBUG_RETURN
(
trp
);
DBUG_RETURN
(
trp
);
...
@@ -6749,7 +6754,8 @@ TRP_ROR_INTERSECT *get_best_covering_ror_intersect(PARAM *param,
...
@@ -6749,7 +6754,8 @@ 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
only_ror_scans_required set to TRUE when we are only interested
in ROR scan
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
...
@@ -6759,7 +6765,7 @@ static TRP_RANGE *get_key_scans_params(PARAM *param, SEL_TREE *tree,
...
@@ -6759,7 +6765,7 @@ 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
)
bool
only_
ror_scans_required
)
{
{
uint
idx
;
uint
idx
;
SEL_ARG
**
key
,
**
end
,
**
key_to_read
=
NULL
;
SEL_ARG
**
key
,
**
end
,
**
key_to_read
=
NULL
;
...
@@ -6806,8 +6812,7 @@ static TRP_RANGE *get_key_scans_params(PARAM *param, SEL_TREE *tree,
...
@@ -6806,8 +6812,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
(
ror_scans_required
&&
!
param
->
is_ror_scan
&&
if
(
only_ror_scans_required
&&
!
param
->
is_ror_scan
)
!
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 */
continue
;
continue
;
...
...
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