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

CONNECT PIVOT should use SELECT DISTINCT instead of SELECT *

    XMLWordPrintable

    Details

      Description

      When creating a CONNECT PIVOT table, the engine executes SELECT * on the target table. This seems really inefficient to me.

      In an ideal situation, there will be some usable index on the pivot column, so SELECT DISTINCT pivotCol will be much faster.

      To find the names of columns, a separate query to find table structure could be executed. I can't think of why the engine would need to do SELECT * when creating the table.

      Is there some explanation I'm missing?

        Attachments

          Activity

            People

            Assignee:
            bertrandop Olivier Bertrand
            Reporter:
            kolbe Kolbe Kegel (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Git Integration