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

optimization improvement - INTERSECT with empy query via LIMIT 0 should eliminate both query parts

    XMLWordPrintable

Details

    • Bug
    • Status: Confirmed (View Workflow)
    • Minor
    • Resolution: Unresolved
    • 11.7.2
    • 10.11, 11.4, 11.8
    • Optimizer
    • None
    • docker

    Description

      The following two queries will always return an empty result. However, the second query wastes execution time. If there are a large number of queries connected through the INTERSECT keyword, the wasted computing time will be very large.

      MariaDB > USE information_schema;

      MariaDB [information_schema]> SELECT * from TABLES CROSS JOIN VIEWS ON TABLES.TABLE_NAME != VIEWS.TABLE_NAME LIMIT 0;
      Empty set (0.001 sec)

      MariaDB [information_schema]> SELECT * from TABLES CROSS JOIN VIEWS ON TABLES.TABLE_NAME != VIEWS.TABLE_NAME INTERSECT SELECT * from TABLES CROSS JOIN VIEWS ON TABLES.TABLE_NAME NOT LIKE VIEWS.TABLE_NAME LIMIT 0;
      Empty set (5.483 sec)

      Attachments

        Issue Links

          Activity

            People

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