summaryrefslogtreecommitdiff
path: root/sql/multi_range_read.cc
diff options
context:
space:
mode:
authorSergey Petrunya <psergey@askmonty.org>2011-06-03 00:25:58 +0400
committerSergey Petrunya <psergey@askmonty.org>2011-06-03 00:25:58 +0400
commit9482e387e6a2e947dc0679f01262a983f24e848c (patch)
treed9e2b89553919cdfad739712e6432dd5b678f9b4 /sql/multi_range_read.cc
parentc44c1bd188fc01ca56490d20e855035e8299b33f (diff)
downloadmariadb-git-9482e387e6a2e947dc0679f01262a983f24e848c.tar.gz
Change optimizer_use_mrr=auto|disable|force
to be optimizer_switch flags mrr=on|off and mrr_cost_based=on|off.
Diffstat (limited to 'sql/multi_range_read.cc')
-rw-r--r--sql/multi_range_read.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/sql/multi_range_read.cc b/sql/multi_range_read.cc
index cbd98cb41af..c666c571787 100644
--- a/sql/multi_range_read.cc
+++ b/sql/multi_range_read.cc
@@ -1416,7 +1416,7 @@ ha_rows DsMrr_impl::dsmrr_info_const(uint keyno, RANGE_SEQ_IF *seq,
/*
If HA_MRR_USE_DEFAULT_IMPL has been passed to us, that is an order to
use the default MRR implementation (we need it for UPDATE/DELETE).
- Otherwise, make a choice based on cost and @@optimizer_use_mrr.
+ Otherwise, make a choice based on cost and @@optimizer_switch settings
*/
if ((*flags & HA_MRR_USE_DEFAULT_IMPL) ||
choose_mrr_impl(keyno, rows, flags, bufsz, cost))
@@ -1520,7 +1520,8 @@ bool DsMrr_impl::choose_mrr_impl(uint keyno, ha_rows rows, uint *flags,
bool using_cpk= test(keyno == table->s->primary_key &&
primary_file->primary_key_is_clustered());
*flags &= ~HA_MRR_IMPLEMENTATION_FLAGS;
- if (thd->variables.optimizer_use_mrr == 2 || *flags & HA_MRR_INDEX_ONLY ||
+ if (!optimizer_flag(thd, OPTIMIZER_SWITCH_MRR) ||
+ *flags & HA_MRR_INDEX_ONLY ||
(using_cpk && !doing_cpk_scan) || key_uses_partial_cols(table, keyno))
{
/* Use the default implementation */
@@ -1537,12 +1538,12 @@ bool DsMrr_impl::choose_mrr_impl(uint keyno, ha_rows rows, uint *flags,
bool force_dsmrr;
/*
- If @@optimizer_use_mrr==force, then set cost of DS-MRR to be minimum of
+ If mrr_cost_based flag is not set, then set cost of DS-MRR to be minimum of
DS-MRR and Default implementations cost. This allows one to force use of
DS-MRR whenever it is applicable without affecting other cost-based
choices.
*/
- if ((force_dsmrr= (thd->variables.optimizer_use_mrr == 1)) &&
+ if ((force_dsmrr= !optimizer_flag(thd, OPTIMIZER_SWITCH_MRR_COST_BASED)) &&
dsmrr_cost.total_cost() > cost->total_cost())
dsmrr_cost= *cost;