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

optimizer aware that inner join implies not null

    XMLWordPrintable

Details

    Description

      You can reduce Handler_read_next in an INNER JOIN by specifying the column to be joined IS NOT NULL in the where clause, which is implicitly true:

      -- 15% execution time reduction with large number of matching rows
      select count(*) from t1 inner join t2 on t1.id=t2.a where t2.b=98765;
      select count(*) from t1 inner join t2 on t1.id=t2.a where t2.b=98765 and t2.a is not null;
      

      -- 80% execution time reduction with smaller number of matching rows
      select count(*) from t1 inner join t2 on t1.id=t2.a where t2.b=54321;
      select count(*) from t1 inner join t2 on t1.id=t2.a where t2.b=54321 and t2.a is not null;
      

      I kept buffer pool as 128MB since the tables are pretty small on disk and the results are more pronounced when not all data fits in memory.

      I wanted to include a way to generate this with sequence tables (which is what I used) but a dump file would be a lot easier and takes about 5 minutes to load on my pretty small instance. Is there a way to send a 300+MB file?

      Attachments

        Activity

          People

            psergei Sergei Petrunia
            mg MG
            Votes:
            0 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.