List:Commits« Previous MessageNext Message »
From:Jorgen Loland Date:October 22 2010 1:36pm
Subject:bzr commit into mysql-next-mr-bugfixing branch (jorgen.loland:3231) WL#5594
View as plain text  
#At file:///export/home/jl208045/mysql/wl4800/mysql-next-mr-opt-backporting-wl4800-patchcleanup/ based on revid:jorgen.loland@stripped

 3231 Jorgen Loland	2010-10-22
      WL#5594 - Add optimizer traces to the range optimizer
      
      In addition to step_down_to(), sel_arg_range_seq_next() also
      stores range info used when evaluating range access. This 
      needs to be added to the optimizer trace.
     @ sql/opt_range.cc
        Add optimizer trace when sel_arg_range_seq_next() stores a range used to evaluate range access.

    modified:
      mysql-test/r/optimizer_trace_range.result
      sql/opt_range.cc
=== modified file 'mysql-test/r/optimizer_trace_range.result'
--- a/mysql-test/r/optimizer_trace_range.result	2010-10-22 08:31:43 +0000
+++ b/mysql-test/r/optimizer_trace_range.result	2010-10-22 13:36:50 +0000
@@ -1466,7 +1466,7 @@ EXPLAIN SELECT * FROM t2 WHERE key1a = 5
                       {
                         "index": "i1b",
                         "ranges": [
-                          "key1b < 10"
+                          "key1b < 10 : 5 <= key1a <= 5"
                         ] /* ranges */,
                         "index_only": false,
                         "records": 9,

=== modified file 'sql/opt_range.cc'
--- a/sql/opt_range.cc	2010-10-22 08:31:43 +0000
+++ b/sql/opt_range.cc	2010-10-22 13:36:50 +0000
@@ -8149,19 +8149,35 @@ walk_right_n_up:
             !memcmp(cur[-1].min_key, cur[-1].max_key, len) &&
             !key_tree->min_flag && !key_tree->max_flag))
       {
+        SEL_ARG *store_key_part= key_tree->next_key_part;
         seq->param->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],
-                                                   &cur->min_key,
-                                                   &cur->min_key_flag,
-                                                   MAX_KEY);
+            store_key_part->store_min_key(seq->param->key[seq->keyno],
+                                          &cur->min_key,
+                                          &cur->min_key_flag,
+                                          MAX_KEY);
         if (!key_tree->max_flag)
           cur->max_key_parts += 
-            key_tree->next_key_part->store_max_key(seq->param->key[seq->keyno],
-                                                   &cur->max_key,
-                                                   &cur->max_key_flag,
-                                                   MAX_KEY);
+            store_key_part->store_max_key(seq->param->key[seq->keyno],
+                                          &cur->max_key,
+                                          &cur->max_key_flag,
+                                          MAX_KEY);
+
+        if (seq->param->thd->opt_trace && seq->param->thd->opt_trace->is_started())
+        {
+          // Trace the range we just stored 
+          KEY_PART_INFO *kpi= 
+            seq->param->table->key_info[seq->real_keyno].key_part + 
+            store_key_part->part; 
+      
+          uint16 length= kpi->length;
+          append_range(&key_range_trace, kpi,
+                       store_key_part->min_value, length,
+                       store_key_part->max_value, length,
+                       store_key_part->min_flag | store_key_part->max_flag);
+        }
+
         break;
       }
     }


Attachment: [text/bzr-bundle] bzr/jorgen.loland@oracle.com-20101022133650-u6q4m0uv4eol2jdy.bundle
Thread
bzr commit into mysql-next-mr-bugfixing branch (jorgen.loland:3231) WL#5594Jorgen Loland22 Oct