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

LP:940652 - Non-semi-join materialization creates too many temp. tables

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Resolution: Not a Bug
    • None
    • None
    • None

    Description

      Non-semi-join materialization strategy creates too many temp. tables:

      CREATE TABLE t1(a int);
      INSERT INTO t1 values(1),(2);
      CREATE TABLE t2(a int);
      INSERT INTO t2 values(1),(2);
      set optimizer_switch='semijoin=off';
      flush status;
      SELECT * FROM t1 WHERE a IN (SELECT * FROM t2 GROUP BY a HAVING a > 1);
      SHOW STATUS LIKE 'Created_tmp_tables';
      ------------------------------+

      Variable_name Value

      ------------------------------+

      Created_tmp_disk_tables 0
      Created_tmp_files 0
      Created_tmp_tables 3

      ------------------------------+

      The query creates 3 temporary tables. Note that with default settings (semijoin=on) it will create two:

      • one for group by
      • another for doing subquery materialization.
        one could argue that even two tables are too many for this example since they have identical data and keys. In general case, two tables may be required. However, creating three tables is a bug.

      Attachments

        Activity

          People

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