Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-33742

do not create spider group by handler when all tables are constant

Details

    Description

      psergei's suggestion from MDEV-33704.

      Attachments

        Issue Links

          Activity

            ycp Yuchen Pei added a comment - - edited

            Hi psergei, ptal thanks:

            upstream/bb-10.4-mdev-33742 ea6fc73758e38859bb2ad0dd9aedbf5b173b398e
            MDEV-33742 Do not create spider group by handler when all tables are constant
             
            Also removed a macro PARTITION_HAS_GET_CHILD_HANDLERS which is defined
            in spd_environ.h, similar to MDEV-27658.
            

            The test spider/bugfix.mdev_33679 covers a case where all tables are const, and spider/bugfix.mdev_26247 covers at least one case where some but not all tables are const.

            ycp Yuchen Pei added a comment - - edited Hi psergei , ptal thanks: upstream/bb-10.4-mdev-33742 ea6fc73758e38859bb2ad0dd9aedbf5b173b398e MDEV-33742 Do not create spider group by handler when all tables are constant   Also removed a macro PARTITION_HAS_GET_CHILD_HANDLERS which is defined in spd_environ.h, similar to MDEV-27658. The test spider/bugfix.mdev_33679 covers a case where all tables are const, and spider/bugfix.mdev_26247 covers at least one case where some but not all tables are const.

            ycp, I don't have any objections to the patch, but do we need to fix this on the Spider end?

            Maybe, for the benefit of other remote engines, fix it on the SQL Layer end:

            diff --git a/sql/sql_select.cc b/sql/sql_select.cc
            index 9e8b8e4ebe0..6653cf600b0 100644
            --- a/sql/sql_select.cc
            +++ b/sql/sql_select.cc
            @@ -3346,7 +3346,7 @@ bool JOIN::make_aggr_tables_info()
                 distinct in the engine, so we do this for all queries, not only
                 GROUP BY queries.
               */
            -  if (tables_list && top_join_tab_count && !procedure)
            +  if (tables_list && top_join_tab_count && !only_const_tables() && !procedure)
               {
                 /*
                   At the moment we only support push down for queries where
            

            psergei Sergei Petrunia added a comment - ycp , I don't have any objections to the patch, but do we need to fix this on the Spider end? Maybe, for the benefit of other remote engines, fix it on the SQL Layer end: diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 9e8b8e4ebe0..6653cf600b0 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -3346,7 +3346,7 @@ bool JOIN::make_aggr_tables_info() distinct in the engine, so we do this for all queries, not only GROUP BY queries. */ - if (tables_list && top_join_tab_count && !procedure) + if (tables_list && top_join_tab_count && !only_const_tables() && !procedure) { /* At the moment we only support push down for queries where

            I'm fine either way...

            psergei Sergei Petrunia added a comment - I'm fine either way...
            ycp Yuchen Pei added a comment - - edited

            Sounds like a good idea to ban it from the sql level. Updated the patch, also splitted out the spider cleanup commit, ptal thanks

            b669db4159d bb-10.4-ycp upstream/bb-10.4-mdev-33742 MDEV-33742 Do not create group by handler when all tables are constant
            466b8110c2a MDEV-33742 Remove macro PARTITION_HAS_GET_CHILD_HANDLERS
            

            ycp Yuchen Pei added a comment - - edited Sounds like a good idea to ban it from the sql level. Updated the patch, also splitted out the spider cleanup commit, ptal thanks b669db4159d bb-10.4-ycp upstream/bb-10.4-mdev-33742 MDEV-33742 Do not create group by handler when all tables are constant 466b8110c2a MDEV-33742 Remove macro PARTITION_HAS_GET_CHILD_HANDLERS

            ycp,

            commit b669db4159d70d492358f9582b00caaecef80896 (origin/bb-10.4-ycp, origin/bb-10.4-mdev-33742)
            Author: Yuchen Pei <ycp@mariadb.com>
            Date:   Mon Mar 25 14:00:11 2024 +1100
             
                MDEV-33742 Do not create group by handler when all tables are constant
                
                Also removed a macro PARTITION_HAS_GET_CHILD_HANDLERS which is defined
                in spd_environ.h, similar to MDEV-27658.
            
            

            Please remove the "Also removed ... " as it is not a part of this patch anymore.
            Ok to push after this is done.

            466b8110c2a MDEV-33742 Remove macro PARTITION_HAS_GET_CHILD_HANDLERS
            

            Ok to push.

            psergei Sergei Petrunia added a comment - ycp , commit b669db4159d70d492358f9582b00caaecef80896 (origin/bb-10.4-ycp, origin/bb-10.4-mdev-33742) Author: Yuchen Pei <ycp@mariadb.com> Date: Mon Mar 25 14:00:11 2024 +1100   MDEV-33742 Do not create group by handler when all tables are constant Also removed a macro PARTITION_HAS_GET_CHILD_HANDLERS which is defined in spd_environ.h, similar to MDEV-27658. Please remove the "Also removed ... " as it is not a part of this patch anymore. Ok to push after this is done. 466b8110c2a MDEV-33742 Remove macro PARTITION_HAS_GET_CHILD_HANDLERS Ok to push.
            ycp Yuchen Pei added a comment -

            Thanks for the review. Once the blocking ticket MDEV-33679 is reviewed and pushed I will amend the commit message and push this one.

            ycp Yuchen Pei added a comment - Thanks for the review. Once the blocking ticket MDEV-33679 is reviewed and pushed I will amend the commit message and push this one.
            ycp Yuchen Pei added a comment -

            Pushed the following to 10.4

            f9e0ebeca49 * upstream/bb-10.4-mdev-33742 upstream/10.4 MDEV-33742 Do not create group by handler when all tables are constant
            e865ef6a04d * MDEV-33742 Remove macro PARTITION_HAS_GET_CHILD_HANDLERS
            

            ycp Yuchen Pei added a comment - Pushed the following to 10.4 f9e0ebeca49 * upstream/bb-10.4-mdev-33742 upstream/10.4 MDEV-33742 Do not create group by handler when all tables are constant e865ef6a04d * MDEV-33742 Remove macro PARTITION_HAS_GET_CHILD_HANDLERS

            People

              ycp Yuchen Pei
              ycp Yuchen Pei
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.