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

SHOW PROFILE reports duplicate "Sending data" stage for INSERT...SELECT

    XMLWordPrintable

Details

    • Unexpected results

    Description

      SHOW PROFILE for an INSERT...SELECT query reports "Sending data" twice. The second entry is misleading, no data is being sent at that point.

      Steps to reproduce:
      CREATE TABLE profile_test (
      id INT PRIMARY KEY AUTO_INCREMENT,
      name VARCHAR(100),
      value INT
      );
      INSERT INTO profile_test (name, value) VALUES
      ('alpha',1),('beta',2),('gamma',3),('delta',4),('epsilon',5),
      ('zeta',6),('eta',7),('theta',8),('iota',9),('kappa',10);
      SET profiling = 1;
      INSERT INTO profile_test (name, value)
      SELECT name, value FROM profile_test LIMIT 5;
      SHOW PROFILE;

      Actual output (abbreviated):

      Executing 0.000036
      Sending data 0.002404
      Removing tmp table 0.000098
      Sending data 0.000079 ← duplicate

      Expected:
      Stage entries reflect actual execution phases.
      Actual:
      A second "Sending data" entry appears after "Removing tmp table" due to a save/restore of the previous stage name inside function free_tmp_table, not because data is being sent

      See also: MDEV-34900

      Other query types may be affected. Under investigation.

      GROUP BY:
      SELECT name, COUNT( * ) FROM profile_test GROUP BY name;

      Actual output (abbreviated):

      Executing 0.000023
      Sending data 0.002111
      Creating sort index 0.000646
      Removing tmp table 0.000165
      Creating sort index 0.000149 ←duplicate

      is affected by the same save/restore pattern inside free_tmp_table

      Attachments

        Activity

          People

            sanja Oleksandr Byelkin
            santi alexandra raveala
            Votes:
            0 Vote for this issue
            Watchers:
            1 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.