Description:
I worked on bug #38813 and I recognised that when you have a loop of selects in a routine then it won't be displayed the needed time for the single select. Instead the needed time always will be added to the time before.
Example:
mysql> call test_call_multiple_times;
...
1 row in set (0.16 sec)
...
1 row in set (0.31 sec)
...
1 row in set (0.46 sec)
...
...
...
1 row in set (15.09 sec)
Query OK, 0 rows affected (15.09 sec)
I think it would be better to have an output like this:
mysql> call test_call_multiple_times;
...
1 row in set (0.16 sec)
...
1 row in set (0.15 sec)
...
1 row in set (0.15 sec)
...
...
...
1 row in set (0.14 sec)
Query OK, 0 rows affected (15.09 sec)
How to repeat:
Just take the test from bug #38813.
DROP TABLE IF EXISTS my_test_table;
DROP VIEW IF EXISTS my_test_view;
CREATE TABLE my_test_table
(uid INT UNSIGNED PRIMARY KEY)
Engine=MyISAM;
CREATE VIEW my_test_view AS
SELECT
uid
FROM my_test_table;
DROP PROCEDURE IF EXISTS test_call_multiple_times;
DELIMITER //
CREATE PROCEDURE test_call_multiple_times
()
BEGIN
DECLARE num_iters INTEGER DEFAULT 10000;
DECLARE i INTEGER;
DECLARE value INTEGER;
SET i = 0;
my_loop: LOOP
IF (i = num_iters)
THEN
LEAVE my_loop;
END IF;
SELECT COUNT(*) FROM information_schema.tables INTO value;
SET i = i + 1;
IF ((i % 100) = 0)
THEN
SELECT i AS 'Iterations completed';
END IF;
END LOOP my_loop;
END//
DELIMITER ;
Suggested fix:
This is a feature request.