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

Code get_best_combination() computes aggr_tables incorrectly

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.3(EOL), 10.4(EOL), 10.5, 10.6, 10.7(EOL), 10.8(EOL), 10.9(EOL)
    • 10.11
    • Optimizer
    • None

    Description

      I've discovered this when investigating MDEV-23809.

      There is code get_best_combination that computes the number of aggregate tables:

         /*
          Additional plan nodes for postjoin tmp tables:
            1? + // For GROUP BY
            1? + // For DISTINCT
            1? + // For aggregation functions aggregated in outer query
                 // when used with distinct
            1? + // For ORDER BY
            1?   // buffer result
          Up to 2 tmp tables are actually used, but it's hard to tell exact number
          at this stage.
        */
        uint aggr_tables= (group_list ? 1 : 0) +
                          (select_distinct ?
                           (tmp_table_param.using_outer_summary_function ? 2 : 1) : 0) +
                          (order ? 1 : 0) +
             (select_options & (SELECT_BIG_RESULT | OPTION_BUFFER_RESULT) ? 1 : 0) ;
      

      We don't have specific examples yet, but we suspect it might be incorrect.

      One thing that was discovered is that tmp_table_param.using_outer_summary_function is set after this piece of code is executed.

      Attachments

        Issue Links

          Activity

            People

              psergei Sergei Petrunia
              psergei Sergei Petrunia
              Votes:
              0 Vote for this issue
              Watchers:
              1 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.