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

Optimizer switch split_materialized does not switch select_type to "LATERAL DERIVED" on Windows

    XMLWordPrintable

Details

    • Bug
    • Status: Confirmed (View Workflow)
    • Critical
    • Resolution: Unresolved
    • 10.6.18, 10.11.8
    • 10.6, 10.11
    • None
    • None

    Description

      To reproduce this problem, import attached schema tt (tt.zip) as an example. Then, run this:

      set session optimizer_switch='split_materialized=on';
      explain SELECT `ServerID`,
      `ServerIP`, `ServerPort`, ROUND(IFNULL(CAST(`SessionCount` AS UNSIGNED),CONVERT(0,UNSIGNED)) / 10) AS `SessionBucket`
      FROM `Servers` 
      LEFT JOIN (SELECT `Servers_ServerID`,CONVERT(COUNT(1),UNSIGNED) AS `SessionCount` FROM `Session` GROUP BY `Servers_ServerID`) `SC` ON (`ServerID` = `SC`.`Servers_ServerID`);
      

      On linux, you will see "LATERAL DERIVED" as select_type:

      +------+-----------------+------------+-------+------------------------+------------------------+---------+---------------------+------+-------------+
      | id   | select_type     | table      | type  | possible_keys          | key                    | key_len | ref                 | rows | Extra       |
      +------+-----------------+------------+-------+------------------------+------------------------+---------+---------------------+------+-------------+
      |    1 | PRIMARY         | Servers    | index | NULL                   | Server_UNIQUE          | 164     | NULL                | 30   | Using index |
      |    1 | PRIMARY         | <derived2> | ref   | key0                   | key0                   | 5       | tt.Servers.ServerID | 2    |             |
      |    2 | LATERAL DERIVED | Session    | ref   | fk_Session_Servers_idx | fk_Session_Servers_idx | 4       | tt.Servers.ServerID | 25   | Using index |
      +------+-----------------+------------+-------+------------------------+------------------------+---------+---------------------+------+-------------+
      

      On Windows, you cannot get this optimization. See the attached images.
      Tested on Windows releases 10.11.8 and 10.6.18.

      Attachments

        Activity

          People

            psergei Sergei Petrunia
            edward Edward Stoever
            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.