List:Commits« Previous MessageNext Message »
From:Ole John Aske Date:February 29 2012 1:58pm
Subject:bzr push into mysql-trunk-cluster branch (ole.john.aske:3433 to 3434)
View as plain text  
 3434 Ole John Aske	2012-02-29
      Updated AQP interface after WL5558 has been merged:
      
      As all test_if_skip_sort_order() has been evaluated prior to building
      any 'pushed joins', we can now use the JOIN::ordered_index_usage to
      determine if GROUP/ORDER BY is skippable instead of calculating this 
      inside the AQP interface.

    modified:
      sql/abstract_query_plan.cc
      sql/abstract_query_plan.h
 3433 Ole John Aske	2012-02-29
      Accept some changed MTR results after merge from mysql-trunk
     @ mysql-test/r/group_by.result
        File updated by taking direct copy from branch mysql-trunk.
        For some reason these files had diverged.
     @ mysql-test/r/range_all.result
        File updated by taking direct copy from branch mysql-trunk.
        For some reason these files had diverged.
     @ mysql-test/suite/ndb/r/ndb_join_pushdown_default.result
        Due to fix for bug#13596176, obsolete 'Using where' has been removed from execution plan
     @ mysql-test/suite/ndb/r/ndb_join_pushdown_nobnl.result
        Due to fix for bug#13596176, obsolete 'Using where' has been removed from execution plan
     @ mysql-test/suite/ndb/r/ndb_join_pushdown_none.result
        Due to fix for bug#13596176, obsolete 'Using where' has been removed from execution plan
     @ mysql-test/suite/ndb/r/ndb_subquery.result
        New subquery optimization features in trunk has been added.
        Updated result file to accept these.
     @ mysql-test/t/group_by.test
        File updated by taking direct copy from branch mysql-trunk.
        For some reason these files had diverged.

    modified:
      mysql-test/r/group_by.result
      mysql-test/r/range_all.result
      mysql-test/suite/ndb/r/ndb_join_pushdown_default.result
      mysql-test/suite/ndb/r/ndb_join_pushdown_nobnl.result
      mysql-test/suite/ndb/r/ndb_join_pushdown_none.result
      mysql-test/suite/ndb/r/ndb_subquery.result
      mysql-test/t/group_by.test
=== modified file 'sql/abstract_query_plan.cc'
--- a/sql/abstract_query_plan.cc	2012-01-04 20:25:40 +0000
+++ b/sql/abstract_query_plan.cc	2012-02-29 13:57:43 +0000
@@ -21,7 +21,6 @@
 #include "abstract_query_plan.h"
 
 
-
 namespace AQP
 {
 
@@ -64,76 +63,20 @@ namespace AQP
     return m_join_tabs + join_tab_no;
   }
 
-  void
-  Join_plan::find_skippabable_group_or_order() const
-  {
-    const
-    JOIN* const join= m_join_tabs->join;
-
-    if (join->const_tables < join->tables)
-    {
-      JOIN_TAB* join_head= join->join_tab+join->const_tables;
-  
-      m_group_by_filesort_is_skippable= join->group_optimized_away;
-      m_order_by_filesort_is_skippable= join->skip_sort_order;
-
-      /* A single row don't have to be sorted */
-      if (join_head->type == JT_CONST  || 
-          join_head->type == JT_SYSTEM || 
-          join_head->type == JT_EQ_REF)
-      {
-        m_group_by_filesort_is_skippable= true;
-        m_order_by_filesort_is_skippable= true;
-      }
-      else if (join->select_options & SELECT_BIG_RESULT)
-      {
-        /* Excluded from ordered index optimization */
-      }
-      else if (join->group_list && !m_group_by_filesort_is_skippable)
-      {
-        if (!join->tmp_table_param.quick_group || join->procedure)
-        {
-          /* Unsure how to handle - Is disabled in ::compute_type_and_index() */
-        }
-        if (join->simple_group)
-        {
-          /**
-            test_if_skip_sort_order(...group_list...) already done by JOIN::optimize().
-            As we still have a 'simple_group', GROUP BY has been optimized through an
-            access path providing an ordered sequence as required by GROUP BY:
-
-            Verify this assumption in ASSERT below:
-          */
-          DBUG_ASSERT(test_if_skip_sort_order(join_head, join->group_list,
-                                              join->unit->select_limit_cnt, true, 
-                                              &join_head->table->keys_in_use_for_group_by));
-          m_group_by_filesort_is_skippable= true;
-        }
-      }
-      else if (join->order && !m_order_by_filesort_is_skippable)
-      {
-        if (join->simple_order)
-        {
-          m_order_by_filesort_is_skippable= 
-            test_if_skip_sort_order(join_head,
-                                    join->order,
-                                    join->unit->select_limit_cnt, false, 
-                                    &join_head->table->keys_in_use_for_order_by);
-        }
-      }
-    }
-  }
-
   bool
   Join_plan::group_by_filesort_is_skippable() const
   {
-    return (m_group_by_filesort_is_skippable == true);
+    const JOIN* const join= m_join_tabs->join;
+    return (join->group_list && join->simple_group && 
+            join->ordered_index_usage==JOIN::ordered_index_group_by);
   }
 
   bool
   Join_plan::order_by_filesort_is_skippable() const
   {
-    return (m_order_by_filesort_is_skippable == true);
+    const JOIN* const join= m_join_tabs->join;
+    return (join->order && join->simple_order && 
+            join->ordered_index_usage==JOIN::ordered_index_order_by);
   }
 
   /**
@@ -384,12 +327,6 @@ namespace AQP
       DBUG_VOID_RETURN;
     }
 
-    /* First non-const table may provide 'simple' ordering for entire join */
-    if (join_tab == join->join_tab+join->const_tables)
-    {
-      m_join_plan->find_skippabable_group_or_order();
-    }
-
     /*
       Identify the type of access operation and the index to use (if any).
     */

=== modified file 'sql/abstract_query_plan.h'
--- a/sql/abstract_query_plan.h	2011-10-20 19:52:11 +0000
+++ b/sql/abstract_query_plan.h	2012-02-29 13:57:43 +0000
@@ -90,11 +90,6 @@ namespace AQP
     const uint m_access_count;
     Table_access* m_table_accesses;
 
-    mutable bool m_group_by_filesort_is_skippable;
-    mutable bool m_order_by_filesort_is_skippable;
-
-    void find_skippabable_group_or_order() const;
-
     const JOIN_TAB* get_join_tab(uint join_tab_no) const;
 
     // No copying.

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk-cluster branch (ole.john.aske:3433 to 3434) Ole John Aske5 Mar