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

Split Materialized code: last_refills is never set in 11.0+

Details

    Description

      In current 11.4, as of commit:

      commit 38e420ba6e84ef6efc9c54b04ebd4dbc95dc3cae (HEAD -> 11.4, origin/st-11.4-merge, origin/11.4)
      Merge: e1277845a47 652f33e0a44
      Author: Marko Mäkelä <marko.makela@mariadb.com>
      Date:   Tue Mar 11 13:47:46 2025 +0200
       
          Merge 10.11 into 11.4
      

      variable SplM_opt_info::last_refills is used but never set:

      sql$  grep last_refills *.h *.cc
      opt_split.cc:  double last_refills;
      opt_split.cc:    startup_cost= spl_opt_info->last_refills * spl_plan->cost;
      

      The variable was introduced in:

      commit ce7ffe61d836fe9f0cfc1087f058bc40d66e5cfb
      Author: Igor Babaev <igor@askmonty.org>
      Date:   Tue May 2 23:17:07 2023 -0700
       
          MDEV-26301 Split optimization refills temporary table too many times
          
          This patch optimizes the number of refills for the lateral derived table
          to which a materialized derived table subject to split optimization is
          is converted. This optimized number of refills is now considered as the
          expected number of refills of the materialized derived table when searching
          for the best possible splitting of the table.
      

      which did set it:

      +  double last_refills;
      +        spl_opt_info->last_refills= refills;
      +    startup_cost= spl_opt_info->last_refills * spl_plan->cost;
      

      In 10.11, the line setting the variable is present. In 11.0, it is not.

      Looking at its fate in 11.0.
      The last commit before above mentioned Igor's cset was merged:

      commit 5ba3bafb834dbc56e6105809ded9a7ccef70ee54 (origin/tmp1, origin/HEAD, tmp1, psergey-before-borked)
      Author: Oleksandr Byelkin <sanja@mariadb.com>
      Date:   Wed May 31 16:57:34 2023 +0200
       
          Fix of maturity
      

      Then, the merge right at the 11.0.2 tag:

      commit 0005f2f06c8e1aea4915887decad67885108a929 (HEAD -> psergey-borked, tag: mariadb-11.0.2)
      Merge: 5ba3bafb834 4e2b93dffef
      Author: Sergei Golubchik <serg@mariadb.org>
      Date:   Mon Jun 5 19:27:00 2023 +0200
       
          Merge branch 'bb-10.11-release' into bb-11.0-release
      
      

      brought just two lines:

      opt_split.cc:  double last_refills;
      opt_split.cc:    startup_cost= spl_opt_info->last_refills * spl_plan->cost;
      

      Attachments

        Issue Links

          Activity

            There are no comments yet on this issue.

            People

              psergei Sergei Petrunia
              psergei Sergei Petrunia
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

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