diff options
author | unknown <sanja@askmonty.org> | 2013-09-26 21:20:15 +0300 |
---|---|---|
committer | unknown <sanja@askmonty.org> | 2013-09-26 21:20:15 +0300 |
commit | e5746665c9f8dcfa66a7a645f1c5517769a2fa0a (patch) | |
tree | 56e9d83b5ef43f93d9628c25f69b81f174d48f5c /sql/multi_range_read.cc | |
parent | 828be0d9bae813d0587fbede6e02b12eebac66ca (diff) | |
parent | 9d83468e78ba23f024ce3c11443913ad75cf1ea5 (diff) | |
download | mariadb-git-e5746665c9f8dcfa66a7a645f1c5517769a2fa0a.tar.gz |
merge 10.0-base -> 10.0
Diffstat (limited to 'sql/multi_range_read.cc')
-rw-r--r-- | sql/multi_range_read.cc | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/sql/multi_range_read.cc b/sql/multi_range_read.cc index e42ea9ec452..03023927a1d 100644 --- a/sql/multi_range_read.cc +++ b/sql/multi_range_read.cc @@ -1494,10 +1494,10 @@ ha_rows DsMrr_impl::dsmrr_info_const(uint keyno, RANGE_SEQ_IF *seq, @retval FALSE No */ -bool key_uses_partial_cols(TABLE *table, uint keyno) +bool key_uses_partial_cols(TABLE_SHARE *share, uint keyno) { - KEY_PART_INFO *kp= table->key_info[keyno].key_part; - KEY_PART_INFO *kp_end= kp + table->key_info[keyno].user_defined_key_parts; + KEY_PART_INFO *kp= share->key_info[keyno].key_part; + KEY_PART_INFO *kp_end= kp + share->key_info[keyno].user_defined_key_parts; for (; kp != kp_end; kp++) { if (!kp->field->part_of_key.is_set(keyno)) @@ -1518,10 +1518,11 @@ bool key_uses_partial_cols(TABLE *table, uint keyno) @retval FALSE Otherwise */ -bool DsMrr_impl::check_cpk_scan(THD *thd, uint keyno, uint mrr_flags) +bool DsMrr_impl::check_cpk_scan(THD *thd, TABLE_SHARE *share, uint keyno, + uint mrr_flags) { return test((mrr_flags & HA_MRR_SINGLE_POINT) && - keyno == table->s->primary_key && + keyno == share->primary_key && primary_file->primary_key_is_clustered() && optimizer_flag(thd, OPTIMIZER_SWITCH_MRR_SORT_KEYS)); } @@ -1557,14 +1558,15 @@ bool DsMrr_impl::choose_mrr_impl(uint keyno, ha_rows rows, uint *flags, Cost_estimate dsmrr_cost; bool res; THD *thd= current_thd; + TABLE_SHARE *share= primary_file->get_table_share(); - bool doing_cpk_scan= check_cpk_scan(thd, keyno, *flags); - bool using_cpk= test(keyno == table->s->primary_key && + bool doing_cpk_scan= check_cpk_scan(thd, share, keyno, *flags); + bool using_cpk= test(keyno == share->primary_key && primary_file->primary_key_is_clustered()); *flags &= ~HA_MRR_IMPLEMENTATION_FLAGS; if (!optimizer_flag(thd, OPTIMIZER_SWITCH_MRR) || *flags & HA_MRR_INDEX_ONLY || - (using_cpk && !doing_cpk_scan) || key_uses_partial_cols(table, keyno)) + (using_cpk && !doing_cpk_scan) || key_uses_partial_cols(share, keyno)) { /* Use the default implementation */ *flags |= HA_MRR_USE_DEFAULT_IMPL; @@ -1572,7 +1574,7 @@ bool DsMrr_impl::choose_mrr_impl(uint keyno, ha_rows rows, uint *flags, return TRUE; } - uint add_len= table->key_info[keyno].key_length + primary_file->ref_length; + uint add_len= share->key_info[keyno].key_length + primary_file->ref_length; *bufsz -= add_len; if (get_disk_sweep_mrr_cost(keyno, rows, *flags, bufsz, &dsmrr_cost)) return TRUE; |