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

Performance degradation when using ALL subquery in WHERE clause without XOR false

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 11.7.2, 10.6, 11.8
    • None
    • Optimizer
    • win11 with docker

    Description

      I encountered a potential performance bug when executing the following query:
      ```sql
      SELECT 1 AS ref0 WHERE (0 > ALL (SELECT 1 AS ref1 FROM t1, t2, t3, t4, t5, t6, t7, t8, t9 WHERE true));
      ```
      This query took extremely long time to execute. However, when I executed the following queries, instant results were generated.
      ```sql
      SELECT (0 > ALL (SELECT 1 AS ref1 FROM t1, t2, t3, t4, t5, t6, t7, t8, t9 WHERE true)) xor false as ref0;
      SELECT (0 > ALL (SELECT 1 AS ref1 FROM t1, t2, t3, t4, t5, t6, t7, t8, t9 WHERE true)) as ref0;
      SELECT 1 AS ref0 WHERE (0 > ALL (SELECT 1 AS ref1 FROM t1, t2, t3, t4, t5, t6, t7, t8, t9 WHERE true)) XOR false;
      ```
      I expect the first query processed quickly like the other 3.
      The setup can be found in the attachment.

      Attachments

        Activity

          People

            psergei Sergei Petrunia
            Phasheng Bosheng Peng
            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.