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

Procedure statements write wrong Query_time into slow log

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 12.2
    • 12.2
    • Stored routines
    • None
    • Can result in unexpected behaviour

    Description

      Query_time for SP statements always display cululating time. Looks wrong. They should display query time for individial statements.

      This script demonstrates:

      DELIMITER $$
      CREATE OR REPLACE PROCEDURE p1() 
      BEGIN
        SELECT SLEEP(0.02);
        SELECT SLEEP(0.02);
        SELECT SLEEP(0.02);
        SELECT SLEEP(0.02);
      END;
      $$
      DELIMITER ;
       
      SET GLOBAL slow_query_log=ON;
      SET SESSION authorization root@localhost;
      SET SESSION log_slow_verbosity='explain';
      SET log_slow_disabled_statements=admin;
      SET long_query_time=0.01;
      USE test;
      CALL p1();
      

      # User@Host: root[root] @ localhost []
      # Thread_id: 3  Schema: test  QC_hit: No
      # Query_time: 0.020463  Lock_time: 0.000074  Rows_sent: 1  Rows_examined: 0
      # Rows_affected: 0  Bytes_sent: 68
      # Stored_routine: test.p1
      SET timestamp=1768979152;
      SELECT SLEEP(0.02);
      # User@Host: root[root] @ localhost []
      # Thread_id: 3  Schema: test  QC_hit: No
      # Query_time: 0.040597  Lock_time: 0.000074  Rows_sent: 1  Rows_examined: 0
      # Rows_affected: 0  Bytes_sent: 68
      # Stored_routine: test.p1
      SET timestamp=1768979152;
      SELECT SLEEP(0.02);
      # User@Host: root[root] @ localhost []
      # Thread_id: 3  Schema: test  QC_hit: No
      # Query_time: 0.060789  Lock_time: 0.000074  Rows_sent: 1  Rows_examined: 0
      # Rows_affected: 0  Bytes_sent: 68
      # Stored_routine: test.p1
      SET timestamp=1768979152;
      SELECT SLEEP(0.02);
      # User@Host: root[root] @ localhost []
      # Thread_id: 3  Schema: test  QC_hit: No
      # Query_time: 0.080985  Lock_time: 0.000074  Rows_sent: 1  Rows_examined: 0
      # Rows_affected: 0  Bytes_sent: 68
      # Stored_routine: test.p1
      SET timestamp=1768979152;
      SELECT SLEEP(0.02);
      # User@Host: root[root] @ localhost []
      # Thread_id: 3  Schema: test  QC_hit: No
      # Query_time: 0.081103  Lock_time: 0.000074  Rows_sent: 4  Rows_examined: 0
      # Rows_affected: 0  Bytes_sent: 283
      SET timestamp=1768979152;
      CALL p1();
      

      Attachments

        Issue Links

          Activity

            People

              sanja Oleksandr Byelkin
              bar Alexander Barkov
              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.