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

Eliminate derived tables having DISTINCT and/or UNION

    XMLWordPrintable

Details

    • Task
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • None
    • None
    • None

    Description

      MDEV-26278 only considers derived tables having GROUP BY expressions. But if a derived table has SELECT DISTINCT this can also be considered as if table has a unique key on selected fields, and so can be a subject to elimination:

      select t1.* from t1 left join  (select distinct a from t2) D on D.a=t1.a;
      

      Also MDEV-26278 does not implement elimination for derived tables with UNION, though it seems possible:

      select t1.* from t1 left join 
        (select distinct a from t2
         union
         select distinct a from t3) D 
      on D.a=t1.a;
      

      Attachments

        Issue Links

          Activity

            People

              oleg.smirnov Oleg Smirnov
              oleg.smirnov Oleg Smirnov
              Votes:
              0 Vote for this issue
              Watchers:
              4 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.