diff options
author | Varun Gupta <varun.gupta@mariadb.com> | 2019-05-28 15:43:12 +0530 |
---|---|---|
committer | Varun Gupta <varun.gupta@mariadb.com> | 2019-05-28 17:17:44 +0530 |
commit | 5e36f5dd00d706baea7af623f09711d66ba0109c (patch) | |
tree | 27d460a04c08255b7b116a4138fac3f99a78eea6 /sql/opt_range_mrr.cc | |
parent | 24773bf38024d32c9af4e6bc09e67043318bba6e (diff) | |
download | mariadb-git-5e36f5dd00d706baea7af623f09711d66ba0109c.tar.gz |
MDEV-18741: Optimizer trace: multi-part key ranges are printed incorrectly
Changed the function append_range_all_keyparts to use sel_arg_range_seq_init / sel_arg_range_seq_next to produce ranges.
Also adjusted to print format for the ranges, now the ranges are printed as:
(keypart1_min, keypart2_min,..) OP (keypart1_name,keypart2_name, ..) OP (keypart1_max,keypart2_max, ..)
Also added more tests for range and index merge access for optimizer trace
Diffstat (limited to 'sql/opt_range_mrr.cc')
-rw-r--r-- | sql/opt_range_mrr.cc | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/sql/opt_range_mrr.cc b/sql/opt_range_mrr.cc index 3a25da3edb2..d3a1e155fb7 100644 --- a/sql/opt_range_mrr.cc +++ b/sql/opt_range_mrr.cc @@ -53,6 +53,11 @@ typedef struct st_sel_arg_range_seq int i; /* Index of last used element in the above array */ bool at_start; /* TRUE <=> The traversal has just started */ + /* + Iteration functions will set this to FALSE + if ranges being traversed do not allow to construct a ROR-scan" + */ + bool is_ror_scan; } SEL_ARG_RANGE_SEQ; @@ -165,7 +170,7 @@ bool sel_arg_range_seq_next(range_seq_t rseq, KEY_MULTI_RANGE *range) seq->i--; step_down_to(seq, key_tree->next); key_tree= key_tree->next; - seq->param->is_ror_scan= FALSE; + seq->is_ror_scan= FALSE; goto walk_right_n_up; } @@ -207,7 +212,7 @@ walk_right_n_up: !memcmp(cur[-1].min_key, cur[-1].max_key, len) && !key_tree->min_flag && !key_tree->max_flag)) { - seq->param->is_ror_scan= FALSE; + seq->is_ror_scan= FALSE; if (!key_tree->min_flag) cur->min_key_parts += key_tree->next_key_part->store_min_key(seq->param->key[seq->keyno], @@ -312,7 +317,7 @@ walk_up_n_right: range->range_flag |= UNIQUE_RANGE | (cur->min_key_flag & NULL_RANGE); } - if (seq->param->is_ror_scan) + if (seq->is_ror_scan) { /* If we get here, the condition on the key was converted to form @@ -327,7 +332,7 @@ walk_up_n_right: (range->start_key.length == range->end_key.length) && !memcmp(range->start_key.key, range->end_key.key, range->start_key.length) && is_key_scan_ror(seq->param, seq->real_keyno, key_tree->part + 1))) - seq->param->is_ror_scan= FALSE; + seq->is_ror_scan= FALSE; } } seq->param->range_count++; |