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

Query against view over IS tables worse than equivalent query without view

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.5.28
    • Fix Version/s: 5.5.29
    • Component/s: None
    • Labels:
      None
    • Environment:
      Linux x64

      Description

      A view which access an information schema table seems to use another plan, than the query in its extend explain output (it scan's all databases)

      CREATE VIEW v1 AS SELECT TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS;

      explain extended select column_name FROM v1 WHERE TABLE_SCHEMA="osm" AND TABLE_NAME="test";

      extra: Using where; Open_frm_only; Scanned all databases

      show warnings;
      ..
      select `information_schema`.`COLUMNS`.`COLUMN_NAME` AS `COLUMN_NAME` from `INFORMATION_SCHEMA`.`COLUMNS` where ((`information_schema`.`COLUMNS`.`TABLE_SCHEMA` = 'osm') and (`information_schema`.`COLUMNS`.`TABLE_NAME` = 'test'))

      explain select `information_schema`.`COLUMNS`.`COLUMN_NAME` AS `COLUMN_NAME` from `INFORMATION_SCHEMA`.`COLUMNS` where ((`information_schema`.`COLUMNS`.`TABLE_SCHEMA` = 'osm') and (`information_schema`.`COLUMNS`.`TABLE_NAME` = 'test'));

      extra: Using where; Open_frm_only; Scanned 0 databases

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            timour Timour Katchaounov added a comment -

            The problem is present in MySQL 5.6.7 as well.

            Show
            timour Timour Katchaounov added a comment - The problem is present in MySQL 5.6.7 as well.
            Hide
            timour Timour Katchaounov added a comment -
            • Review discussion with Sanja, some more tests, approved by Sanja
            • Merged into latest 5.5, pushed
            Show
            timour Timour Katchaounov added a comment - Review discussion with Sanja, some more tests, approved by Sanja Merged into latest 5.5, pushed

              People

              • Assignee:
                timour Timour Katchaounov
                Reporter:
                georg Georg Richter
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 3 hours
                  3h